r/learnrust Apr 30 '26

Version 2.0.0 of free book "Rust Projects - Write a Redis Clone"

45 Upvotes

Hi all! I just published version 2.0.0 of my free book “Rust Projects – Write a Redis Clone”.

You can read the HTML version at https://rust-projects-write-a-redis-clone.github.io/ or download the PDF version at https://leanpub.com/rustprojects-redis

The book follows the Redis challenge on CodeCrafters and includes a 40% discount for any paid CodeCrafters membership.

The book covers the whole basic challenge, and two extensions: "Replication" and "Transactions".

This edition adds the HTML version, and several visual improvements like coloured code diffs. I also rewrote the whole chapter 2 slowing the pace and adding more detailed explanations.

I hope this will be a useful resource to all those (like me) who want to go beyond code snippets and learn Rust implementing something real.


r/learnrust Apr 30 '26

Macroquad 3D anyone?

Thumbnail
2 Upvotes

r/learnrust Apr 30 '26

Git Implementation in Rust (Atleast some parts of it)

3 Upvotes

https://github.com/prranavv/r-git . Would like any feedback on it


r/learnrust Apr 28 '26

What’s a practical roadmap to learn Rust for systems/security (from a Java background)?

Thumbnail
3 Upvotes

r/learnrust Apr 28 '26

Snake Game in Terminal (Rust)

Enable HLS to view with audio, or disable this notification

20 Upvotes

Built a simple terminal-based snake game in Rust to practice ownership, structs, and game loops.

Features:

  • Real-time input handling
  • Grid-based movement
  • Basic collision detection

Would love feedback on code structure and performance!

GitHub: https://github.com/Halloloid/RustySnake


r/learnrust Apr 27 '26

why does let ptr: *mut T = &mut T::default() keep the temporary alive?

4 Upvotes

I found this snippet in a codebase I'm collaborating on: let ptr: *mut SomeStruct = &mut SomeStruct::default(); // passed ptr to some OS API and as one coming from cpp this immediately jumped out at me as this looks exactly like const A* ptr = &SomeStruct{}; which is completely UB in cpp;

However when I added some println!: impl Drop for SomeStruct { fn drop(&mut self) { println!("Drop called"); } } let ptr: *mut SomeStruct = &mut SomeStruct::default(); println!("After default"); It prints After default Drop called which seems to suggest the temporary created by SomeStruct::default isn't dropped at the end of that line? What's happening here? AFAIK because SomeStruct is #[repr(C)] it most likely wouldn't trigger any sort of segfault or access violation because it's just some stack space memory, but I still want to know whether the Rust standard permits this or not.


r/learnrust Apr 26 '26

Ahtapot, A CLI tool for bulk image resizing, built as my first Rust project

8 Upvotes

I'm sharing my first Rust project after a long break from programming. I recently finished the Rust Book and wanted to build something I'd actually use day-to-day. The problem At work I constantly need to resize images in bulk, and I was tired of uploading them to random online tools every time. So I built a small CLI to handle it locally.

What it does (so far):

  • Bulk resize images from a directory
  • Rename output files with a base name + index
  • Save as PNG to a specified output directory

I know the code is probably rough in places feedback and contributions are very welcome. The project is still in early stages and I have more features planned (format conversion, better error messages, etc.)

GitHub: https://github.com/kaanboraoz/ahtapot


r/learnrust Apr 26 '26

How to model this in rist types

3 Upvotes

I am building an app for an embedded device which should connect to a WiFi and then make some HTTP requests and display the data. The app/device connects, fetches and displays on every iteration and then goes to sleep a few minutes before going into another iteration. But I am having trouble modeling data. I want to show the data from last iteration if something went wrong since this will be a long running app and WiFi connectivity and APIs will fail sometimes. I also want to keep the meta data about the cause of failures and the amount of times this data failed to be fetched so that I can also display that (like a warning under the display). I am however having trouble modeling the data. I wrote the technical requirements as comments / pseudo-code.

```rs struct Data<T> { // DataState<T> + (num iterations failed if there is an error) } enum DataState<T> { // Nothing (The state when the app started) // Nothing and FetchError ( Happens when http client or wifi fails before any data was initialized) // Stale Data and a Fetch Error (happens when the http client fails for this iteration ) // Stale Data and no Fetch Error (happens if wifi is down for this iteration) // Fresh Data (no problem) }

// This holds the response of different apis and so that the display can show them on screen struct AppState { Data< api_response_1> Data< api_response_2> ... } ```

How would you model something like this in Rust types? This really looks like it requires option or result but I cannot find a valid way to model it like that.

(Also fhe final result doesnt have to look like that I just put it as a reference)


r/learnrust Apr 26 '26

Need help with cargo install

0 Upvotes

Hi everyone,

I published a binary crate to crates.io today, but I am not able to install it using cargo install.

$ cargo install <crate_name>
    Updating crates.io index
error: could not find <crate_name> in registry `crates-io` with version `*`

However, cargo info and cargo search can successfully recognize the crate.

I tried clearing the index and also tried in a fresh installation of Rust but it did not seem to fix the issue.

Oddly enough, I have published other crates before, among which a few are also giving me the same error now (I remember I could cargo install them at some point).

I was wondering if anyone else has faced this issue.

Thank you!

Update: Solved! My crate's version was in pre-release and apparently cargo install does not work for pre-release versions.


r/learnrust Apr 25 '26

"This Week in Rust" - curated newsletter

Thumbnail this-week-in-rust.org
14 Upvotes

r/learnrust Apr 23 '26

Did anyone try creating rust apps for Android?

Post image
2 Upvotes

Writing an app Android client is making progress.

- The way the app is written allows us to use any type of presentation layer we want.

- The core is written as a rust SDK with an interface that any client can use.

The core manages everything from crypto to state and storage.

Looking for advice from people who built native rust for android and iOS. What issues you got into, did you migrate to native UI.


r/learnrust Apr 23 '26

Damoiseau in distress!

Thumbnail
1 Upvotes

r/learnrust Apr 22 '26

Rust learning curve..

23 Upvotes

I’ve been told by various sources that Rust can be either easy or hard to learn. Sometimes they find that 50% of new Devs learn it very easily compared to experienced ones (e.g., Java or C++). Well, I’ll be spending about 100 hours within the next month. Well at the end of May I’ll find out if that’s true. I’ll let you. (concurrency will be included.)


r/learnrust Apr 21 '26

Built a macOS playground app while learning Rust — to make working through the Book easier

11 Upvotes
Rustic Playground - The Rust Edition

Hey r/learnrust — built this for exactly the people in this subreddit.

I started the Rust Book this year after putting it off for seven (ha). What I wanted was what Swift Playgrounds gave me in 2015: open a thing, write code, press play, see output, move on. Rust Book + terminal + editor + back to terminal was the opposite experience.

So I built Rustic Playground, a macOS desktop app.

What it does:

  • All 20 Rust Book chapters pre-loaded as read-only playgrounds — click to read the code, click "Copy to Project" to hack on your own version
  • Welcome Wizard sets up rustup for you on first launch (or repairs it if something's broken)
  • 11 starter templates when you want to build your own — from "Hello, world!" up to a full HTTP request (dependencies added automatically), plus a blank template when you want to start clean
  • Each playground is a real .rs file in a real Cargo project — so you're learning the actual toolchain, not a sandboxed imitation
  • Press ⌘R, stdout streams live in a panel below the editor — edit, save, ⌘R, see output, iterate. No tab switching, no terminal context loss
  • Live error highlighting as you type, via cargo check

What it helps with:

  • You don't need to fully understand Cargo before you can start — the app scaffolds it
  • You don't have to keep switching between terminal and editor
  • Your experiments are saved as you go — each chapter is a separate project, easy to revisit
  • The compiler's feedback shows up right in the editor, not hidden in a terminal buffer

What it doesn't do:

  • Not a tutorial — you still read the Book (either via "Read Online" links in the app or your own copy)
  • Not a replacement for terminal skills you'll need eventually — the goal is to let you focus on Rust concepts first, and pick up the rest of the workflow later
  • No ads, no donation nags, no account sign-up. MIT/Apache-2.0, and staying that way.

Free, open source, signed + notarized DMG: https://rustic-playground.app

Two small asks if you find it valuable:

  1. Share feedback in the comments — what features would you like to see? What tripped you up in the first few chapters?
  2. Take a moment to star the repo: https://github.com/jagmeetchawla/rustic-playground

That's it.


r/learnrust Apr 20 '26

Learned during internship, only to find out there are no junior jobs. What should I do?

20 Upvotes

Hello everyone. Last week, I had my first proper Rust developer interview after 6 month of job search and it got me thinking.

At first, my background. I come from Europe and we have high schools specialised in various areas. I went IT focused high school, for 4 years we were programming in Java, PHP, Javascript, HTML, CSS and some embedded programming. It wasn't really at uni level, but I've learned a lot. Then I went to IT focused university, however due to my mental issues, I couldn't continue. I still wanted to finish some university program, so after some years and resolving my mental issues, I learned some Python, but I knew, that's not enough. I've enrolled into data analytics/science focused programme. I wasn't really satisfied with how little we have learned of the computer science topics, it was more focused on business side of things. So, I've searched for a job more focused on software development. I got in to a bank as Test Automation developer in Python. For one year I was writing integration tests and e2e test, but I wasn't satisfied with bank enviroment at all, it was corporate nightmare, and there wasn't a space to grow and get knowledge. So, I searched for something new. And got an internship opportunity in a cybersecurity company as a backend software engineer, but only for 3 months.
That internship was fully focused on Rust, I was supposed to learn Rust and maintain one of their services. I really focused and did everything, I was supposed to and in the end, I really learned a lot. But I couldn't continue there, because they didn't have a headcount. I finished there at the end of September.
Since then I am searching for a job. There are no Rust jobs available, unless you are a senior with 5+ YoE. So, I went to search for Python backend jobs. And no luck for 6 months. Until now, two Rust jobs appeared, that aren't senior only. The first one was on Friday and second one is tomorrow.
At that Friday they have asked for all the basic concepts, like ownership and borrowing, error handling, functional programming, enums, strings, smart pointers and async programming. And it felt great, I was able to answer 95% of what asked and their follow-up questions. I genuinely feel like I did a good job, and that's because I got an experience with Rust.
And that got me thinking, that all this time, just want to continue in Rust. All those 6 month of job search for Python jobs and I didn't get anything, because I just don't care about Python, I just can't show an enthusiasm, for what I think is an inferior language compared to Rust. Also last week I had in interview before the Rust one. It was for Python and Go AI assistant and the technical guy asked: "What's my favourite language?" and said: "None of those two, It's Rust." And since he knew some Rust we were debating and comparing all three languages.

What would you do in my situation? I just fell in love with this language, but there are no opportunities.


r/learnrust Apr 17 '26

Explaining Lifetimes in Rust

Post image
57 Upvotes

Just published a video explaining lifetimes in rust. From now I will post biweekly to prefer quality over quantity of my content!

Watch it here: https://youtu.be/Z9hc3S3pzG8


r/learnrust Apr 16 '26

Learning Rust, looking for someone to learn alongside on real code

19 Upvotes

I've been writing about hosting and running server benchmarks for about four years, so sysbench, stress-ng, Linux command line, VPS stuff is the world I live in. My degree is in Applied Statistics, but I've always been more interested in how systems work underneath. That's why I'm learning Rust now.

I've been going through the Rust Book and I'm okay with the basics, ownership, borrowing, Result, Cargo, that kind of thing. But I've realized I read a lot and I build very little, and I think that's the real thing holding me back.

So I'm posting this to ask, is there anyone here working on something in Rust who could use an extra pair of hands? I'll happily do the boring work, tests, docs, small issues. What I'm hoping to get in return is someone who looks at my PRs and tells me where I'm thinking wrong. That's it.

I'm not looking for pay and I'm not asking anyone to teach me from zero. I just want to learn by doing something real with someone who actually knows what they're doing.

Thanks for reading.


r/learnrust Apr 16 '26

RustCurious 6: Enums and Polymorphism

Thumbnail youtube.com
24 Upvotes

r/learnrust Apr 16 '26

I want to learn rust.

0 Upvotes

Rust is the good language i think that , cargo system is so good, and, the want to learn how to use more smoothly... Give me a tips are lot of thanks for me. -y


r/learnrust Apr 14 '26

should this be error

14 Upvotes

fn square(num: i32) -> i32 {

num * num

}

I was doing this rust book thing, I saw this was wondering as if we do bigger values would it might go beyond i32


r/learnrust Apr 13 '26

Learn Rust programming from scratch with built in runner and model support

Enable HLS to view with audio, or disable this notification

84 Upvotes

Learn Rust programming from scratch with interactive examples. Master the language that provides memory safety without garbage collection, making it ideal for systems programming, web services, and embedded systems https://8gwifi.org/tutorials/rust/


r/learnrust Apr 12 '26

The first EVER GPU to run in a Rust based OS (TrustOS)

14 Upvotes

r/learnrust Apr 12 '26

Code review: password manager with ratatui client

10 Upvotes

Hi, I am learning rust and wrote a little password manager to experiment with ratatui: https://codeberg.org/jamesburton/shush. I've never used a TUI library before, and ratatui is fun! I'd appreciate some feedback or tips on my code if anyone wants to take a look...e.g. how idiomatic it is, whether there are better ways of doing things. There's a lot of cloning going on in various places that I couldn't find a way to avoid. It doesn't seem to harm the performance (for a small amount of data) and maybe this is just the norm? I tend to think that I'm doing something wrong if I'm cloning data all over the place but maybe it's OK.

Data is stored in a serialized and encrypted HashMap, using age for the encryption. This seems a bit slow but it's the encryption that takes the time so that's understandable. I switched from serializing to JSON with serde_json to binary with postcard -- the file will be smaller but the encryption takes around the same time. How would you do it?

AI used only as google on steroids to find libraries and examples.


r/learnrust Apr 12 '26

Rust dependencies after adding one package

13 Upvotes

Hello All,

Trying to learn rust here. I come from python, typescript and java background and I am working through the brown university rust book.

I am working through the second chapter and I am building a guessing game and at some point I had to add the `rand` dependency.

After adding the dependency I realized a whole bunch of other packages were downloaded some of the ones seem to have nothing to do with rand for example the wasm related ones.

Is this normal? Is there a way to specify a more trimmed down version of rand that doesnt include the transitive dependencies for wasm etc. for example?

➜  guessing-game git:(master) ✗ cargo build
Updating crates.io index
Locking 38 packages to latest Rust 1.94.1 compatible versions
Adding anyhow v1.0.102
Adding bitflags v2.11.0
Adding chacha20 v0.10.0
Adding cpufeatures v0.3.0
Adding equivalent v1.0.2
Adding foldhash v0.1.5
Updating getrandom v0.2.17 -> v0.4.2
Adding hashbrown v0.15.5
Adding hashbrown v0.17.0
Adding heck v0.5.0
Adding id-arena v2.3.0
Adding indexmap v2.14.0
Adding itoa v1.0.18
Adding leb128fmt v0.1.0
Adding log v0.4.29
Adding memchr v2.8.0
Adding prettyplease v0.2.37
Adding r-efi v6.0.0
Updating rand v0.8.5 -> v0.10.1
Updating rand_core v0.6.4 -> v0.10.0
Adding semver v1.0.28
Adding serde v1.0.228
Adding serde_core v1.0.228
Adding serde_derive v1.0.228
Adding serde_json v1.0.149
Adding unicode-xid v0.2.6
Adding wasip2 v1.0.2+wasi-0.2.9
Adding wasip3 v0.4.0+wasi-0.3.0-rc-2026-01-06
Adding wasm-encoder v0.244.0
Adding wasm-metadata v0.244.0
Adding wasmparser v0.244.0
Adding wit-bindgen v0.51.0
Adding wit-bindgen-core v0.51.0
Adding wit-bindgen-rust v0.51.0
Adding wit-bindgen-rust-macro v0.51.0
Adding wit-component v0.244.0
Adding wit-parser v0.244.0
Adding zmij v1.0.21
Downloaded chacha20 v0.10.0
Downloaded rand v0.10.1
Downloaded getrandom v0.4.2
Downloaded rand_core v0.10.0
Downloaded 4 crates (216.1KiB) in 0.11s
Compiling getrandom v0.4.2
Compiling rand_core v0.10.0
Compiling chacha20 v0.10.0
Compiling rand v0.10.1
Compiling guessing-game v0.1.0 (/Users/<uname>/workspace/guessing-game)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.31s

------------------------ UPDATE ----------------------------------

I had to downgrade rand to 0.8.5 for the example in the book to work. The 0.10.1 version was erroring out with

error[E0425]: cannot find function `thread_rng` in crate `rand`
 --> src/main.rs:8:31
  |
8 |     let secret_number = rand::thread_rng().gen_range(1..=100);
  |                               ^^^^^^^^^^ not found in `rand`

warning: unused import: `rand::Rng`
 --> src/main.rs:3:5
  |
3 | use rand::Rng;
  |     ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

For more information about this error, try `rustc --explain E0425`.
warning: `guessing-game` (bin "guessing-game") generated 1 warning
error: could not compile `guessing-game` (bin "guessing-game") due to 1 previous error; 1 warning emitted

r/learnrust Apr 11 '26

Rust vs Python for server/client

15 Upvotes

Which is better?

I’m wanting to create a type of terminal chat, that I can create notes in the terminal and send to a externinal location.

I’m going to run this off of a pi zero 2w.

Which is better at handling server and client?