r/learnrust • • 6h ago

Learning advice ? Sorry it is a long post...

12 Upvotes

Hello there Rustaceans! A random gopher enjoyer has accidentally stumbled into this mess and I think I finally found something I can truly enjoy. Sorry in advance for the tone/style I don't really write so much, in fact I am terrified of it, but my psychologist said that doing stuff outside of comfort zone helps :D. (this post might be just yeeted out from here due to some guidelines it is okay)

Over my career (5 years approximately + the unknown amount of overtime I have done), I had the chance to experience a wide array of languages at various startups and corporate environments, and I was somewhat dissapointed in the lack of care and attention to detail that came from just shipping the next thing without thinking about stuff like... I dunno CPU cycles/RAM usage/costs. For a while I thought the problem was with me that I don't look at the BiG PiCTuRe or some nice headline that was flying around recently. I always cared and was interested in what is under the hood, that everything in essence is just bits and bytes, and how we move and work with these bytes describes some behaviours. But well I did learn computer science for a reason and I don't think it was walking over what is down in the trenches as opposed what the trends of our time are doing, I realized this industry tends to learn into the bad trends too early like vibe coding for the sake of shipping more. I am now for some reason,couldn't understand yet, a Principal Engineer at my company.

Not to get too emotional but I was always on a soul searching track until now but alas here I am... I was a C/C++ head from the get-go, doing competitions and I was in a toxic relationship with segmentation fault :D in school, it taught me all kinds of important things, such as planning for buffers sizes in advance knowing the input domain but that gradually faded away... not because I didn't care but because the jobs I happened to do didn't care about it and it was just a spiral down to depression. I managed to get closer to those aforementioned trenches. I mostly work in Go nowadays and it allowed me at least focus on parallelism/concurrency, the only actual thing I enjoyed to do at university back in the day. I didn't really know what I wanted to make with myself until recently, but I said I had enough of this so I started searching.

I jumped out into several angles, focused a bit on high level stuff like architecture and system design it kinda makes sense for me, I mostly play strategy games so yea thinking about components and blocks is right up my alley but when I look into them and I just see pure randomness stemming from the fact of how the languages I have to use at work don't really fit this sense of order I need or want (well I think go is more near that than ever).

So a gamble was made, what if I just look at these boogeymen of programming again, so dreaded by everybody, C/C++ and Rust. Oh boy it was like a breath of fresh air. Not wanting to just read, I started writing my own shell in C since it is a tool I use daily and not knowing the tool you use daily is kinda like having a car that you don't understand internally at all. The simplicity of everything brought back my old memories of when I was trying to find a minimum spanning tree in C/C++ by using arrays to represent nodes in graph:)) (I know it is pain but pain with rewards nonetheless). Now I can't stop and I want to just do more with this, I might be writing shit code but it is shit code that works for me and I enjoy it.

Now the fun part. With Rust I am like on a whole other track of thinking about data and memory and processes. It might not be the easiest thing but I went with writing Redis from scratch with some guidance, but by trying my best to read the docs and apply the concepts. I have to tell you it is a wild ride, everything I read or learn is something I know, but not quite how I understand it or used it before, it clicks but it is like puzzle piece that looks and feels like it should feel but it doesn't. Everything in the toolkit from other languages is here but in a sense it is altered in a way to fit the ownership memory model, maybe I am just too early, I haven't finished the Book completely and I am kinda jumping all around, but well it is my style, exploring random stuff until it all comes together. Sounds crazy but the constraints the language has, finally started to click and I am caring more about performance and code quality, and I am happy.

By offering this personal story I would like to request from this community a bit of a guidance. There are plenty of learning topics and projects and snake oil salesman out there. What do you recommend other than the well entrenched The Rust Book and doing projects like writing Redis (this might be overkill). Are there any low level projects that can be done on any physical hardware that could lead to learning into more of a systems engineering/programming level? My goal would be to fail more to learn more. I don't despise the struggle, I want more of it:))).

P.S.: I am not here to jump on the Rust hype train, I am not switching jobs and I am not in the danger of losing anything, I realized switching jobs doesn't really help I need to make something for myself and I feel like low level concepts are calling me back. I want to learn more about something that I found fascinating and new.


r/learnrust • • 2h ago

Devlog: Optimizing f64 GEMM from 6.5 to ~40 GFLOP/s with a BLIS-style micro-kernel

4 Upvotes

https://adii.fyi/blog/optimizing-matmul-in-rust-from-naive-loops-to-blis/

I wanted to see how far I could push a single-threaded f64 matmul. Started with the usual i-k-j loop, and then spent quite a bit of time looking at asm, then experimenting with SIMD, and eventually working through BLIS-style blocking and packing.

Writing this up was a good way to document the whole process, so thought I'd share it here.


r/learnrust • • 4h ago

Helpful website for RUST

4 Upvotes

Hey guys, currently i am learning rust, i came from cpp background and sometimes it was too difficult for me to write syntax in rust. Even though we know concepts behind rust, we(like me) dont know all the small functions that are require to do something in easy way, so yesterday i got a situation where i need to sort the string so in cpp we will do like

string s = "myself";
sort(s.begin(),s.end());

but in rust

let word = "myself";
let mut chars = word.chars().collect();
chars.sort();
let s = chars.into_iter().collect();

but i don't know all this methods are there, so i gave a prompt to claude and it created this website for me,maybe useful to you https://rustatlas.vercel.app/

Happy programming!!


r/learnrust • • 19h ago

Pub keyword in rust

3 Upvotes
mod a {
    mod b {
        pub fn hello() {
            println!("Hello ")
        }
    }
    pub fn lol() {
        println!("lol is the best thing");
        b::hello();
    }
}
fn main() {
    crate::a::lol();
}

Can anybody explain why main can direclty access a ???
I tested it with a too and a can access b too?
The point is i dont reallly understand the role of pub in case of making module names public like form the above codes i can infer that the module that creates another module can direcly go inside it but only access pub items (marked with pub keyword like hello function).
Yes, to make main access a module b i need to make module b pub
and laslty explain the implict creation of Crate root of crates
Thanks!


r/learnrust • • 1d ago

Why do we need to pass reference & for slicing a String?

Post image
73 Upvotes

r/learnrust • • 13h ago

i reimpliment unix tool wc -- a period of comfortable time

Thumbnail reddit.com
0 Upvotes

r/learnrust • • 1d ago

(Why) don't we have a straightforward way of reading a file char by char?

25 Upvotes

I see BufRead allows reading line by line with .lines(), but I couldn't find a function to read a file char by char. I did some snooping and found that we had a .chars(), but it was deprecated in v1.27 or so due to stability issues. Most places quote variable length characters as the problem, but it doesn't sound like that big of a complexity. Besides, some other languages have this functionality (if i remember right), so its shown to be possible too. So why don't we still have it?

Some places say lines(), and conversion to string literals does the trick, but what if my input file is a single line with gigabytes of chars, or a stream of characters?


r/learnrust • • 1d ago

Started my journey to Rust

Thumbnail reddit.com
1 Upvotes

r/learnrust • • 1d ago

First Rust project: why is my Linux x86_64 binary 12 MB vs 6.1 MB on Windows even with lto = "fat" and strip = true?

1 Upvotes

Hi everyone, I'm finishing up my first real Rust project — a 100% offline desktop document tool that needs to ship as a single portable executable with zero external dependencies, so keeping the binary size small is really important to me. On Windows x64, the release binary is ~6.1 MB, which I'm super happy with. However, when GitHub Actions builds the exact same codebase for Linux x86_64, the output is ~12 MB — almost double the size, even though I already enabled LTO and stripping in Cargo.toml. Here is my full Cargo.toml:

[package]

name = "mtk"

version = "0.1.3"

edition = "2021"

[dependencies]

eframe = "0.31"

zip = { version = "2.2", default-features = false, features = ["deflate"] }

quick-xml = "0.37"

rfd = "0.15"

arboard = "3.4"

lopdf = "0.34"

image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }

ab_glyph = "0.2"

[profile.release]

opt-level = 3

lto = "fat"

codegen-units = 1

panic = "abort"

strip = true

As someone still learning the Rust ecosystem, I'm trying to figure out where those extra ~6 MB on Linux are coming from:

  1. Is rfd pulling in heavy GTK3 bindings on Linux whereas Windows uses native system dialogs?
  2. Does eframe bundle both X11 and Wayland stacks plus default_fonts on top of my own embedded fonts?
  3. Would switching opt-level to "z" or tweaking RUSTFLAGS help without breaking compatibility across Linux distros (and without using UPX, since portable tools often get flagged by AVs)? Here is the repo if anyone wants to check the full setup or GitHub Actions workflow:

https://github.com/voramokroman-cell/mtk/

Any advice on slimming down Linux GUI binaries in Rust would be greatly appreciated!


r/learnrust • • 1d ago

How trait work

Thumbnail reddit.com
1 Upvotes

r/learnrust • • 2d ago

Lessons from building a background task processing library - Njuguna Mureithi | EuroRust 2026

Thumbnail youtu.be
0 Upvotes

At EuroRust in Barcelona, Njuguna shared lessons from five years of building a background task processing library in Rust, from workers as actors to middleware and graceful shutdown đŸĻ€âœ¨

In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu.


r/learnrust • • 2d ago

First project I've done (very mundane

Post image
2 Upvotes

r/learnrust • • 1d ago

My experience learning Rust ended up affecting my mental health, and I want to talk about it.

Thumbnail reddit.com
0 Upvotes

r/learnrust • • 2d ago

Integrating Rust in what I Already Do (Godot)

1 Upvotes

I've been learning rust for the past month and I'm wondering how I could try to integrate it into Godot.

I know this is probably a very common question, but I think itd be best to ask myself for more specific advice.

For context, plans are to probably make some procedural and RPG related stuff although I'm not fully sure on that, I get a bunch of ideas quite often.


r/learnrust • • 3d ago

Inside Cloud Hypervisor: From KVM to a Running VM - Philipp Schuster | EuroRust 2026

Thumbnail youtu.be
2 Upvotes

What actually happens when a virtual machine starts? đŸ–Ĩī¸âœ¨ In his talk at this year's EuroRust, Philipp Schuster followed the path from creating a KVM VM to booting a guest in Cloud Hypervisor, a Rust-based VMM. Check out the full talk now on YouTube! đŸĻ€

In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu.


r/learnrust • • 3d ago

I built a structural code-diff engine in Rust — here's what I learned

0 Upvotes

I've been working on an open-source project called Treediff.

The idea is to make code comparison more structural rather than relying exclusively on line-by-line differences.

The engine uses Tree-sitter-based parsing, hierarchical matching and Merkle-style subtree fingerprints to identify relationships between code structures.

Some of the things I've implemented include:

  • Structural source-code comparison
  • Subtree fingerprinting
  • Move and rename detection
  • Repository-level comparisons
  • Multiple language grammars
  • CLI and reusable library interfaces
  • Machine-readable output

I've also been benchmarking it against tools such as Difftastic, Diffmantic, Diffsitter and GumTree.

The benchmark results are included in the repository, along with the methodology. I'd particularly appreciate independent reproduction rather than asking anyone to take the numbers at face value.

GitHub: https://github.com/A35-777/treediff

Website: https://treediff.pages.dev/

I'd love feedback from Rust developers:

What would you investigate first in a structural diff engine like this: matching correctness, memory usage, parsing performance, or move detection?


r/learnrust • • 2d ago

Rust for Everyone: a free book for when you want to actually read the Rust your AI writes

Post image
0 Upvotes

Book: https://github.com/erkamyaman/rust-anything

Vibe coding got me shipping Rust way faster than I ever could by hand. At some point I wanted to understand what was on the screen too, not to slow down, just to steer better. So I wrote the beginner book I wished I had.

Rust for Everyone is free and short on theory:

- each chapter starts with "guess what this prints", then you run it

- puzzles where you put scrambled lines in order

- a small thing to build at the end of every chapter, and a little CLI at the end of the book

- every example was compiled and run, so nothing in it is broken

It's in 15 languages (the translations are AI drafts, native speakers welcome to fix them), and there's a PDF for each one:

- English: https://github.com/erkamyaman/rust-anything/blob/main/book/en/rust-for-everyone-en.pdf

- įŽ€äŊ“中文: https://github.com/erkamyaman/rust-anything/blob/main/book/zh/rust-for-everyone-zh.pdf

Free, CC BY 4.0, no sign-up.

Book: https://github.com/erkamyaman/rust-anything/tree/main/book


r/learnrust • • 5d ago

I made a phone game to practise Rustlings-style exercises offline, looking for feedback

Post image
18 Upvotes

I wanted to practise Rust on the train without a laptop, so I built Rustforge: each level gives you a small broken Rust program, you fix it on your phone and run it.

Most of the 62 levels are adapted from Rustlings (MIT, credited in the app), plus a few "will it compile?" questions. Topics go from variables up to traits, lifetimes, iterators and closures.

It does not run rustc. I wrote an interpreter in TypeScript for a subset of Rust, and I test it against the real compiler: about 115 programs give the same output or the same error code (E0382, E0308, E0384...) in both. There is no full borrow checker, no async, no threads, no unsafe, so it's a companion to the Book and Rustlings, not a replacement.

It works offline, with no account, ads or tracking. World 1 is free, the other six worlds are a one-time purchase.

iOS: https://apps.apple.com/app/id6815256287

Android: https://play.google.com/store/apps/details?id=com.vleclercq.rustforge

What I'd most like to hear: places where the interpreter behaves differently from rustc, and explanations that are unclear or wrong.


r/learnrust • • 5d ago

Comparative Performance Evaluation and Architectural Analysis of Sorting Algorithms in Rust

Thumbnail zenodo.org
2 Upvotes

Evaluated Algorithms

  • Custom Implementations: Bubble Sort (early-exit flag), Selection Sort, Insertion Sort, Shell Sort (extended Ciura sequence), Merge Sort (preallocated scratch reuse), Quick Sort (median-of-3, Hoare partitioning, tail-call bounding), Heap Sort (Floyd binary max-heap), Tree Sort (explicit BST with duplicate counts), Introsort (Musser hybrid), Timsort (Peters natural-run detection & stack invariants), Counting Sort (bounded histogram frequency counting), Radix Sort (8-pass LSD ping-pong with sign-bit XOR inversion), and Bucket Sort (128-bit safe range distribution).
  • Standard Library Baselines: Rust slice::sort (Driftsort) and slice::sort_unstable (IPNSort).

Key Empirical Findings

  • Instruction-Parallel Sorting Networks: Rust's standard library sort_unstable() (IPNSort) achieves peak comparison-based throughput on uniform random data (12.64 ms at N = 1,000,000), driven by branchless instruction-parallel sorting networks yielding an IPC of 3.49 and a negligible 0.54% cache miss rate.
  • Branch-Free Linear Scalability: 8-pass LSD Radix Sort demonstrates strict linear scaling (19.74 ms at N = 1,000,000) and an ideal 0.00% branch misprediction rate across signed 64-bit integers (i64), outperforming classical Merge Sort by 3.4×.
  • Adaptive Run Detection: On presorted arrays, slice::sort (0.23 ms) and Timsort (0.36 ms at N = 1,000,000) achieve up to 80× speedups by collapsing monotonic runs in linear time.
  • Cache Thrashing in Heap Sort: Non-contiguous parent-child pointer strides (2i+1, 2i+2) cause Heap Sort to incur a massive 31.65% cache miss rate on hardware counters.

Repo - github repo


r/learnrust • • 5d ago

I want to learn Rust to make OS and Kernels

Thumbnail reddit.com
2 Upvotes