r/learnrust • • 1h ago

Checklist and CI tooling for auditing unsafe Windows FFI blocks (WinTUN, WFP, WASAPI/MediaFoundation)

1 Upvotes

a cross-platform privacy & vpn app in Rust that routes device internet traffic through itself to talk with Windows networking, firewall, microphone, and camera systems currently have to bypass automatic memory safety checks in some sections. Is there a manual review checklist or any auto testing tool which scans during build & see memory leaks or crashes


r/learnrust • • 6h ago

A relational database built in Rust as a learning project, supporting the SQLite binary file format.

Thumbnail reddit.com
1 Upvotes

r/learnrust • • 7h ago

New to rust, how's my progress so far?

4 Upvotes

Hello, as you might have read from the title, i am new to rust, and being new to rust also means looking for ways to further improve, and one way to do that is to receive feedback, which i am seeking from this subreddit. I've read parts of the rust book and created projects in rust to put my skills to the test. I am currently working on a simple file IO CLI tool (https://github.com/reehanthenew/Simple-file-IO-CLI-tool/tree/main) and im currently proud of my progress. If i could receive some feedback (i accept any forms of feedback) that would be most appreciated. If i could receive more beginner-friendly projects or more learning materials, that would be much more appreciated. If you would like to monitor my growth, feel free to here: https://github.com/reehanthenew?tab=repositories


r/learnrust • • 8h ago

~450k lines of Rust for an IaaS control plane: numbers and regrets

Thumbnail reddit.com
0 Upvotes

r/learnrust • • 9h ago

Rooomy tutorial

4 Upvotes

I wrote this for people who've programmed before but never touched Rust.

Each chapter is a folder you can build on its own and adds one thing: walking a folder, error handling with Result and ?, an arena tree that the borrow checker likes, rayon, atomics for live progress, a squarified treemap, safe delete, duplicate detection, then installers, signing, auto-update and package managers.

At the end you have Roomy, an app people actually use. Feedback on where it gets confusing would help a lot.

https://github.com/pravin/roomy#the-chapters

Please feedback 🙏


r/learnrust • • 15h ago

Learning path for integrating llama.cpp into a Rust desktop app on Windows

1 Upvotes

I’m building a local semantic search desktop app in Rust and planning to change its inference engine from launching `llama-server` as a separate process to calling llama.cpp in-process through its Windows DLL.

I have basic deep learning knowledge and want to understand the full stack behind the setup like how llama.cpp runs models, how its C API and Rust FFI work, how the DLL is built and loaded, how GGUF embedding and multimodal models are handled, how CPU and GPU backends use the hardware, and how to package and distribute the application and its native dependencies reliably.

What documentation, videos, articles, or example projects would you recommend? I’d especially appreciate a sensible order to study them and practical resources that connect the model and hardware concepts to building a working Rust application.


r/learnrust • • 15h ago

best way to learn rust?

5 Upvotes

hi. i develop using cpp. i want to learn rust to see what the hype is all about and build some systems (core) in rust. what's the best way to learn rust with my bg in cpp? should i learn it from scratch or learn by mapping it to cpp?


r/learnrust • • 22h ago

E0308 when assigning an Option<Enum....>?

1 Upvotes

Hi everyone.

I have this bit of code (Extracted from something much larger) that is throwing up an error as follows:

#[derive(Clone, Debug)]
pub enum CutterComp {
    CompOff,
    LeftFromTool(Option<Expr>),
    RightFromTool(Option<Expr>),
}

Then in a structure definition :

#[derive(Debug, Default)]
struct StateUpdate {
.
.
.
  radius_compensation: Option<CutterComp>,
.
.
}

Then in an impl of Stateupdate :
  fn intepret_block(&mut self) -> Result<(), ErrType> {
  .
  .
  .
   if let Some (c) = self.grouped_gcodes[GCodeGroups::GRadiusComp as usize] {
            match c.0 {
                GCodes::G40 => {
                    trace!("Cutter compensation off");
                    self.radius_compensation = Some<CutterComp::CompOff>;
                }
                GCodes::G41 => {
                    trace!("Cutter compensation left");
                 self.radius_compensation =           Some<CutterComp::LeftFromTool((self.axis.get(&"d")))>;
                }

Where the thing blows up with

error: comparison operators cannot be chained
  --> src/main.rs:259:52
   |
259 |                     self.radius_compensation = Some<CutterComp::CompOff>;
   |                                                    ^                   ^

Any ideas?

Rust usually gets types right almost by magic (Old C hand here), but it seems to think that I have a bool or something.

Rust analyser is saying "expected Option<CutterComp>, found bool" which I do not understand.


r/learnrust • • 1d ago

From Hardware to Human Interface: Building HID Devices in Rust - Frank Lyaruu | EuroRust 2026

Thumbnail youtube.com
1 Upvotes

Have you ever dreamt of building your own keyboard or game controller? 🎮

At this year's EuroRust, Frank Lyaruu showed how surprisingly accessible it is with Rust. Check out this new talk and start building your own plug-and-play devices! 🦀✨

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


r/learnrust • • 2d ago

A userspace TUN VPN/privacy relay in Rust

0 Upvotes

a vpn app in rust facing issue where if corrupt pack arrives worker crashes which is cutting users video call or connection how to design where i can sideline or disregard or discard that packet so users connections doesnt breaks & i dont have to go safety checks for every line.


r/learnrust • • 3d ago

Looking for intermediate Rust project ideas after 8months of learning

18 Upvotes

I been learning Rust for about 8 months now and feel pretty comfortable with the basics (ownership, traits, error handling, simple CLIs).

Now I really want to build something a bit more challenging to level up. What projects did you make around this stage that actually taught you a lot maybe something with async, networking, parsers, or a cool TUI? Would love to hear what worked for you!


r/learnrust • • 3d ago

No `main` function found in crate for library crate

1 Upvotes

I use RustRover IDEA. And the IDEA prompt me an error as No 'main' function found in crate

rust compiler seems treat the library crate as binary crate. And when I add

[lib]
path = "lib.rs"
crate-type = ["cdylib"]

I have try both path = "lib.rs" and path = "src/lib.rs". path = "lib.rs" works but cannot load other module like mod1.rs and module/mod.rs in the same directory as lib.rs. And after I remove the [lib]. No 'main'function found error return.

I try `cargo test' and the error message shows

error[E0583]: file not found for module `mod1`
 --> src/lib.rs:5:1
  |
5 | mod mod1;
  | ^^^^^^^^^^^^^
  |
  = help: to create the module `mod1`, create file "src/lib/mod1.rs" or "src/lib/mod1/mod.rs"
  = note: if there is a `mod mod1` elsewhere in the crate already, import it with `use crate::...` instead

error[E0583]: file not found for module `mod2`
 --> src/lib.rs:6:1
  |
6 | mod mod2;
  | ^^^^^^^^^^^
  |
  = help: to create the module `mod2`, create file "src/lib/mod2.rs" or "src/lib/mod2/mod.rs"
  = note: if there is a `mod mod2` elsewhere in the crate already, import it with `use crate::...` instead

error[E0583]: file not found for module `module`
 --> src/lib.rs:7:1
  |
7 | mod module;
  | ^^^^^^^^^^
  |
  = help: to create the module `module`, create file "src/lib/module.rs" or "src/lib/module/mod.rs"
  = note: if there is a `mod module` elsewhere in the crate already, import it with `use crate::...` instead

error[E0425]: cannot find function `my_func` in the crate root
   --> src/lib.rs:137:16
    |
137 |         crate::my_func(
    |                ^^^^^^^^^^^^^^^^^^^ not found in the crate root
    |
help: consider importing this function
    |
134 +     use crate::lib::my_func;
    |
help: if you import `my_func`, refer to it directly
    |
137 -         crate::my_func(
137 +         my_func(
    |

error: could not compile `<crate-name>` (bin "crate-name>" test) due to 4 previous errors; 5 warnings emitted

r/learnrust • • 4d ago

Need help with a game

0 Upvotes

My friend needs help to compile a java program and port it to rust for his nokia.

If anyone wants to help him, you can contact him on his discord: roccogiu


r/learnrust • • 4d ago

Just made my first ever project in rust, and i love this language

34 Upvotes

uhhhh heres the code built it day 2 of learning rust if anything i did is overcomplicated please just comment or create an issue https://github.com/PoxiTheDev/learning


r/learnrust • • 5d ago

Cargo can't ship prebuilt dependencies. How do you live with the build times?

19 Upvotes

I really like Rust. But build times are one of the few things that really bother me. For one project, we needed to switch off our CI for a while, because every run took 20 minutes and nobody had time yet to set up caching and CI runs got stuck. And my own crate has the same problem.

I maintain mq-bridge, an async crate that moves messages between Kafka, NATS, Postgres, MongoDB, S3, HTTP and more. Every connector is a Cargo feature. Cold dev build of an empty program that depends on it, on an M1:

-cratesbuildtarget dir
all features5343 min 40 s4.7 GB
no features9918 s411 MB

Release builds take 10-20 minutes per target on GitHub Actions. Splitting into many crates doesn't fix that either: a similar but bigger project that did exactly that takes half an hour to build locally and two on GitHub Actions.

The root of it: Cargo has no way to ship a compiled dependency. Every project compiles every crate from source, again and again, on every machine and every CI runner.

My workaround: you build mq-bridge with no features, and every connector you didn't compile in comes from a prebuilt library at runtime:

mq-bridge = {version = "1.5", default-features = false, features = ["plugin"]}

mq_bridge::plugin::load_installed_plugin("full")?;

The library is a 30-35 MB download (brew, conda or a release tarball). I added a dynamic loader that checks availability of API calls on runtime during definition. The slow library build happens once per release in my CI instead of in every project.

But it is a detour. Rust has no stable ABI, so it goes through a C interface. I already had a C library for the Node and Nim packages, otherwise I'd probably have done it differently. And the boundary costs something:

  • 30-40 % memory throughput for single calls, under 10 % when using batch calls. With a real broker, network latency hides most of it.
  • The plugin has its own copy of the engine, so in-memory channels stay on the host side.
  • It's one more dynamic library file to deploy.

I'd rather not need any of this. Is there a better way I'm missing? How do you keep build times and CI under control for crates with many heavy dependencies?


r/learnrust • • 5d ago

Discord bot in Rust

4 Upvotes

I finished the 100 exercises to learn rust book and also took a course at school that used it for half a semester but I never thought of a project to put my knowledge into. Now I have this idea to make a simple discord bot for booking time-slots on a shared remote PC. I can either:

  1. Try to write it in rust as a learning experience
  2. Write it in python to finish quick

I’m also possibly sharing the code with my teammates who may not know rust so that, and wanting to finish it fast discourage me from trying rust discord API.

What are your thoughts?


r/learnrust • • 5d ago

I might be crazy; is there a way to wrap TcpStream in RustCrypto ciphers?

4 Upvotes

Context: I'm writing a Minecraft client (someone go reset the counter), and I'm starting to reach the point of needing to handle encryption. I built a nice system around decoding and encoding seamlessly through the `Read` and `Write` traits, so I could just throw my `TcpStream` into them and magically get the decoded packet out the other end (or throw in a packet and -- you get the picture).

Now, I have my AES/CFB8 cipher ready. Now, my only question is if I can keep using my `Read` and `Write` data handlers or if I need to try something else. Can I somehow get a `Read`/`Write` impl out of a `impl BlockModeEncrypt`?


r/learnrust • • 6d ago

Am I the only one ?

Thumbnail reddit.com
0 Upvotes

r/learnrust • • 6d ago

How do you handle atomic file operations in a CLI tool? (temp dir + rename, Linux vs Windows)

3 Upvotes

Hi everyone,

I’m the developer of Runique, a Django-inspired web framework in Rust. It’s still under heavy development, so please be kind. (Also, I’m French, so sorry for any awkward English.)

I’m currently consolidating the codebase and I’d like your advice on atomic operations.

Take the CLI as an example:

runique new scaffolds a whole project makemigrations generates sea-orm migration files from my own ast/dsl file uploads have the same issue

If something fails midway, the user ends up with a half-generated project or incomplete files.

My plan is to write everything into a temporary directory on the same filesystem as the final destination, then rename it into place once everything succeeded.

My questions:

Is this the idiomatic approach in Rust? Or is there a better pattern? I know rename behaves differently on Linux and Windows (e.g. replacing an existing target, files locked by antivirus or other processes). How do you deal with that in practice? Are there crates you’d recommend (tempfile, atomic-write-file, etc.) or should I stick to std::fs? Do I need to care about fsync for this kind of tool, or is that overkill?

Thanks a lot for any advice!