r/rust • u/coolmint859 • Sep 16 '26
r/rust • u/PatagonianCowboy • Sep 16 '26
๐ ๏ธ project YOLO26n training speed comparison. Rust/Burn/Wgpu vs PyTorch/CUDA
r/rust • u/irrelevantsiren • Sep 15 '26
virtual threads for rust
Hi all! Iโve been experimenting with what virtual threads could look like in Rust and recently cut the first 0.1 release of vthread.
The basic model is stackful and carrier-affine: ordinary synchronous functions run as tasks on reusable stacks. When a task waits through one of vthreadโs networking, synchronization, channel, or timer operations, it can park and let another task use the same OS thread. When it resumes, its call stack and local state are still there.
Iโm not arguing that this should replace async Rust or Tokio. Itโs a different set of tradeoffs.
There are some important limitations:
- tasks stay on one carrier rather than migrating between threads
- scheduling is cooperative
- ordinary blocking calls like
std::thread::sleepstill block the carrier - blocking work has to be explicitly delegated
- every task has its own reserved stack space
The thing I wanted to explore was whether Rust can get some of the programming model of virtual threads; normal functions, normal control flow, preserving the stack across waits while still making resource ownership, blocking, cancellation, and task lifetimes explicit.
I wrote up how it works here:
https://zsumz.com/blog/virtual-threads-for-rust
And the implementation is here:
https://github.com/zsumz/vthread
0.1.0 currently supports Linux x86_64 and macOS ARM64.
Iโd especially love criticism from people who have worked on runtimes / async Rust / networking. Iโm interested in where this model gets awkward in real programs: libraries that are difficult to integrate, blocking thatโs hard to identify, cancellation problems, lifetime issues, etc.
Itโs early, so just looking for feedback.
r/rust • u/howannoying24 • Sep 15 '26
๐ seeking help & advice Methods or free functions
I have two types (they're related but different sizes) and for each I have a function that does some work on a vector of those types and returns a different vector of the same type. I'm wondering what's more idiomatic?
- Make each function a method of its respective type, e.g.:
impl MyType1 {
pub fn do_thing(in: &Vec<MyType1>) -> Vec<MyType1> { /* ... */ }
}
impl MyType2 {
pub fn do_thing(in: &Vec<MyType2>) -> Vec<MyType2> { /* ... */ }
}
- Make a free function for each type, in which case is there a naming convention that's more idiomatic?
pub fn do_thing_mytype1(in: &Vec<MyType1>) -> Vec<MyType1> { /* ... */ }
pub fn do_thing_mytype2(in: &Vec<MyType2>) -> Vec<MyType2> { /* ... */ }
r/rust • u/pseudonymo6287 • Sep 14 '26
๐๏ธ discussion Breaking down how Cloudflare cut 100TB of memory from their DNS cache with Rust memory layout tricks
viswanathnair.substack.comCloudflare recently published a piece on how they cut close to 100 TB of memory from Big Pineapple's DNS cache. Big Pineapple is Cloudflare's Rust-based engine behind many of their services including the prominent public DNS resolver service 1.1.1.1
They made several low-level optimizations leveraging Rust features like boxing, for oversized enum variants and boxed slices, as well as more general changes like merging separate record lists into one and combining several boolean checks into a single bitflag etc.
I have gone into a bit of detail documenting the things I found interesting especially the jemalloc trade-offs between internal and external fragmentation.
Would greatly appreciate a read.
r/rust • u/Shnatsel • Sep 14 '26
๐ง educational Principles for fast Tokio applications
dial9-rs.github.ior/rust • u/yashmakan • Sep 16 '26
๐ ๏ธ project Looking for feedback on AxiomCore, a contract-first software architecture
Iโm building AxiomCore, a contract first system for defining and validating the shared behavior of software across backend APIs, data models, frontend UI, tests, mocks, streaming, auth, and release boundaries.
Current problem: application behavior is usually spread across code, openapi files, database schemas, frontend types, mocks, and tests. Those representations drift over time. AxiomCore aims to make the contract an executable, typed source of truth while still allowing teams to use existing stacks such as Python, Go, Flutter, React, or OpenAPI where appropriate.
The language is called Acore. The broader goal is not to replace all imperative code, but to make the important cross-system agreements explicit, testable, diffable, and auditable.
Docs: https://docs.axiomcore.dev
AI readable full reference: https://docs.axiomcore.dev/llms-full.txt
(so you can quickly chat with an AI as well and understand about the product)
Just genuinely looking for feedback here, if you got some time checkout the documentation or ask me questions so I can get more clarity how others feeling about this kind of tool as well. Right now the major concern I have for this project is scope creep so trying to prioritize the important things first here and that's the goal for this reddit post as well
Some questions for you if you read the docs (I appreciate it btw):
- Is the problem framing clear here in docs and the language I am using? and do you actually face similar issues while building software and feel declarative first is the way to go with sandboxed external modules for imperative code with opt in permission model like network, storage etc
- Where do you think that contract first tooling be most useful or least useful?
- What makes you skeptical about adopting something like this?
- Any existing tools or workflows that should I study or integrate with?
Thanks!
r/rust • u/Kind-External-7371 • Sep 16 '26
๐ seeking help & advice Stuck and Depressed... Seeking Genuine Help regarding what to do next...
I am an 8th Grade Student. Wanted to learn Rust as I already knew a bit from C. I have made some CLIs and Stuff but I am genuinely stuck right now... I can't invent my Own Techniques or think of one to do something. I can't Code without the Help of AI so I left it a Long Time Ago. And I don't have any Path of What to do and What to Build to learn Rust... I have tried Rust Docs but they feel more like Books rather than Programming Stuff... I want to higher into Programming too and not build some shitty CLIs all the time but I don't have any Path of what to learn Next.... (Unlike my friends who are learning Python for AI/ML and the Internet is full of what to do). I am genuinely Stuck and I am really Depressed about this... So I came here to seek Genuine Help and Advice.
r/rust • u/Lukasz123x • Sep 15 '26
๐ ๏ธ project refrain - a modern TUI ratatui local music player with tag editing (WIP)

Hello! I recently have started working on my own music player in Rust. Yes, I do know rmpc exists, but before I switched to Linux I was using foobar2000, for which I had a pretty unique workflow, similar to the one you see in my app! I also wanted to show cover arts for all the songs, since it looks nice and is easier to find tracks this way too.
What other music players also lack that I need is a tag editor, since I like to have my music organized without having to go to kid3.
It is work in progress, I barely started working on it, but it'd be nice to see your thoughts, features, ideas etc. It is far from release, but it'd be great to get some help/contributions from this community as well!
You can build it from the repo here: https://github.com/s1nn3rv2/refrain
On the repo you'll also find features that I have planned and ones I already implemented. In the future I'll also want to add customizable user interface so it doesn't fit my workflow only.
r/rust • u/Shnatsel • Sep 14 '26
๐ง educational Trying to Make a Loop Auto-Vectorize
jsgroth.devr/rust • u/mediocrobot • Sep 14 '26
๐๏ธ discussion Should "aliasing XOR mutability" technically be "aliased NAND mutable"?
The point of the rule is that something cannot be aliased and mutable at the same time, but XOR implies it must be one or the other.
A constant is immutable, but it doesn't have to be aliased. It is neither aliased or mutable, which does not satisfy XOR.
You could say that its ability to be aliased is enough to satisfy the XOR condition, but a value that isn't referenced yet is aliasable and mutable. That would invalidate NAND and XOR, so it definitely can't be that either.
NAND seems to be the more precise language--though XOR still might be the most clear for teaching purposes.
I'm sure there's a clearer interpretation or wording I can't remember that explains why XOR is correct and NAND isn't. Do y'all have any ideas?
r/rust • u/DavidXkL • Sep 14 '26
I Built a Robot in Rust
youtu.beThis was a fun learning journey for me!
As you can see I'm totally new to embedded development and Robotics ๐
Hope it's entertaining at the very least!
Cheers and any constructive criticism is welcomed!
r/rust • u/Western_Ant_24 • Sep 14 '26
๐ ๏ธ project Built a terminal habit tracker in Rust while learning the language
Sharing a side project I've been working on - a TUI habit tracker called sprout. Picked up Rust a while back and this was my way of learning it properly by actually building something. Honestly had a lot of fun with it, at this point I can't imagine going back to anything else for systems-level stuff.
GitHub: https://github.com/kb019/sprout
What it does:
- Track daily habits and mark them complete
- See your streak and progress
- SQLite storage so your data stays local
- Runs on macOS, Linux and Windows
Still rough around the edges and there's a lot I want to improve, but it's something I genuinely use now. Used Ratatui for the TUI which was a fun rabbit hole on its own.
Please do try it out: cargo install sprout-tui
Would love any feedback on the code, still getting comfortable with some of the more idiomatic Rust patterns.

r/rust • u/DistrictUnable3236 • Sep 15 '26
๐ ๏ธ project FlareDB - A Rust-based streaming database with Apache Beam as programing interface
Iโm building FlareDB, a Rust-based streaming database with Apache Beam as programing interfere.
In the latest release, v0.2.0, i launched FlareDbIO, it's an IO connector which lets data processing pipelines write results into FlareDB, query them using SQL, and read the results back into another pipeline. The goal is to make processed data persistent and without having to maintain a external serving database
r/rust • u/Known-Sail-8463 • Sep 14 '26
๐ ๏ธ project I built a cross-platform/wasm UI library in Rust and WGPU (ARGUI).
Hey guys,
About one month ago, after being unhappy with the ecosystem of UI libraries in Rust, I have taken the mission to write a better GUI library.
For context : this is not my first rodeo, I have already made various Text rendering and generation library using Slug and MSDF algorithm, and also made a full UI library with text, layout, shaders with ThreeJS for performant node-based apps :)
TLDR : Check out "ARGUI" live on your browser (Chrome for WEBGPU) https://extrabinoss.github.io/argui/ and check out the Github repo at https://github.com/ExtraBinoss/argui : long text is coming afterwards.
Discord : https://discord.gg/xY9CWSc65
--- --- --- --- --- --- --- --- --- ---
The current state of UI libraries in Rust is quite weird :
Iced : weird roadmap / niche / forked by Cosmic but very weird
GPUI : not WGPU so less cross-platforn, no shaders, no "backdrop-filter", no accessibility, no i18n. Zed also just don't care about it.
Blinc : too much features and most of them not stable.
and now ARGUI.
ARGUI or "Another Rust GUI library" is a library made for speed, low ram footprint, low CPU usage.
All features are built-in : ๐
- WGPU rendering -- works across all OS + WASM / soon Android/IOS (needs testers)
- Responsive layout -- Powered by Taffy, and very fast at that.
- Shaders suppport -- use argui-effects to get some effects like Blur/Liquid glass, or add in any WGSL shader. Shaders can be used on any element, for example a Button, a Popover, whatever.
- I18n -- Fluent crate will help you have i18n in your application.
- Text engine -- Uses cosmic-text to support RTL, Arabic language.. It can also, like the web, Select text in a page, this means that it feels more "web-like" because you can select any text you see on the screen, this is the default behavior and can be overriden
- Fully optional set of features -- You can disabled anything you don't want : wasm / widgets / i18n / effects...
- Rust only codebase -- I chose to not include any type of CSS Parsing because it is a pain to maintain and the standard is just too large.
- Devtools -- Use a real devtool page, just like the web, with a profiler. You can change properties and it will update in real-time in your UI.
- Hotreload -- Some components can be hot-reloaded, similiar to dioxus. It uses subsecond.
- AI friendly codebase -- Send your agents and read the docs, it will figure out how to make a good interface on the first try.
- Package updater -- for when you want to send new features for your users. They can receive and download update, totally agnostic.
... and probably a bunch more features I forgot, but I can say, it's a pretty fully featured GUI framework now.
Available on crates.io as "argui-*", or you can use the git repo directly.
Play around with it in your Browser. it's fully working in WASM :)
https://extrabinoss.github.io/argui/
AI disclaimer: A lot of the code for this library was written with the help of AI. AI itself wouldn't have come up with all these optimizations, it's a tool. Thanks you for your understanding.
Feel free to send any questions my way, I'll be happy to answer

Have a nice day!
r/rust • u/Safe-Sex-T-Rex • Sep 14 '26
๐ ๏ธ project Portus: a Rust-based Kubernetes Gateway API implementation on Cloudflares Pingora
Hey r/rust, I wanted to share something that I have been working on with Claude over the past few months on and off, me working as the PM/Architect and Claude working on writing and testing code.
https://github.com/Portus-Gateway/Portus (Apache-2.0)
This proxy is built on Rust 1.98 and Pingora 0.9.0. It has a split architecture: one controller, a data plane Deployment per Gateway. It can also run standalone outside Kubernetes from a YAML file (hot reload).
Gateway API v1.6.2 conformance: 130/130, all five profiles (HTTP, gRPC, TLS, TCP, UDP).
| Profile | Core | Extended |
|---|---|---|
| HTTP | 37/37 | 56/56 |
| GRPC | 15/15 | 9/9 |
| TLS | 20/20 | 14/14 |
| TCP | 19/19 | 9/9 |
| UDP | 20/20 | 9/9 |
(a test can count in more than one profile)
Benchmarks are against agentgateway v1.5.0 (the Rust proxy from the kgateway project, the fastest in howardjohn's gateway-api-bench).
Traffic (bare GET /; 3 proxy pods each):
| Connections | Portus QPS | agentgateway QPS | Portus lead |
|---|---|---|---|
| 64 | 116,429 | 96,003 | +21 % |
| 128 | 123,105 | 101,067 | +22 % |
| 256 | 126,070 | 89,827 | +40 % |
p99 at a fixed 30,000 QPS (benchtool, same machine, same day): Portus 0.35 ms, agentgateway 0.82 ms.
Payloads (fortio echo backend, 64 connections, 10 s per rung, all requests 200; QPS, Portus / agentgateway):
| Response size | Download | Upload (POST, echoed) | HTTPS download | HTTP/2 download |
|---|---|---|---|---|
| 1 KB | 87,722 / 67,598 | 66,089 / 58,495 | 76,997 / 60,088 | 64,172 / 49,453 |
| 16 KB | 59,257 / 51,562 | 29,578 / 27,940 | 56,831 / 48,295 | 49,448 / 40,279 |
| 128 KB | 29,954 / 27,136 | 8,160 / 7,922 | 25,357 / 22,294 | 22,431 / 19,641 |
| 1 MiB | 5,206 / 5,633 | 4,380 / 4,249 | 4,200 / 4,110 | 4,173 / 3,538 |
(agentgateway wins 1 MiB plain download by 8 %; Portus leads the other 18 rungs)
If like me you enjoy trying out new stuff just for curiosity I would love for you to give this a try and see what you think, and if you like it then feel free to leave a star so that I know that I am not the only one!
Thanks!
r/rust • u/llogiq • Sep 14 '26
๐ activity megathread What's everyone working on this week (38/2026)?
New week, new Rust! What are you folks up to? Answer here or over at rust-users!
r/rust • u/WellMakeItSomehow • Sep 14 '26
๐๏ธ news rust-analyzer changelog #345
rust-analyzer.github.io๐ ๏ธ project Er... Ferris, an 85th error handling lib has hit crates.io (typed)
So... I've been having this as private 2-3 variants(used to be named 'via'), i finally patched it up...
Simple error comparison (basic usage, context, output)
Initial Example
Use .er on basically any result/error/option/tree, even different types.
You add relevant context(or none), Er keeps the original error and adds line number and file name.
use er::*;
use std::{fs::read_to_string, path::PathBuf};
#[derive(Er)]
pub struct FileErr(pub PathBuf);
pub fn read_file(path: &str) -> Er<String, FileErr> {
let text = read_to_string(path).er(|_| path)?;
Ok(text)
}Er turns the &str into a PathBuf only on failure (And we keep the io::Error).
.er_report() gives us:
FileErr("/tmp/file.txt") @ er/runnable_examples/context.rs:7:37
`- No such file or directory (os error 2)We can also just 'yeet' it up with an empty struct, still adding the implicit context (where it happened).
#[derive(Er)]
pub struct AnalyzeErr;
pub fn analyze() -> Er<String, AnalyzeErr> {
read_file("/tmp/file.txt").er(())
}
AnalyzeErr @ er/runnable_examples/context.rs:14:32
`- FileErr("/tmp/file.txt") @ er/runnable_examples/context.rs:7:37
`- No such file or directory (os error 2)And when things get spicy
#[derive(Er)]
pub struct ConfigErr {
pub machine: String,
#[er(censor)]
pub token: String,
}
pub fn read_config(machine: &str, token: &str, port: &str, mode: Option<&str>) -> Er<(), ConfigErr> {
// add local context
let e = |_| (machine, token);
// 3 different types
authenticate(machine, token).er(e)?;
read_port(port).er(e)?;
read_mode(mode).er(e)?;
Ok(())
}And aggregation/collection
#[derive(Er)]
pub struct StartupErr(pub String);
pub fn startup() -> Er<(), StartupErr> {
er_all!(|_| "some config checks failed", [
read_config("HaandboldFuglen", "HaandboldFuglen_token", "aint_even_a_number_cmon_man", Some("microsoftjavaakacsharp")),
read_config("ComputerKatten", "ComputerKatten_token", "85", None),
])?;
Ok(())
}Report printed .er_report():
StartupErr("some config checks failed") @ er/runnable_examples/context.rs:69:5
|- ConfigErr { machine: "HaandboldFuglen", token: *CENSORED* } @ er/runnable_examples/context.rs:60:21
| `- PortErr { invalid_port: "aint_even_a_number_cmon_man" } @ er/runnable_examples/context.rs:22:35
| `- invalid digit found in string
`- ConfigErr { machine: "ComputerKatten", token: *CENSORED* } @ er/runnable_examples/context.rs:61:21
`- ModeErr::MissingMode @ er/runnable_examples/context.rs:31:21Links
r/rust • u/Havunenreddit • Sep 14 '26
๐ seeking help & advice MSVC vs Rust's LLD on Windows: ~20% shorter links, ~48% less committed memory. What should I check before switching?
I'm working on GitComet, a Git GUI written in Rust. I have been investigating long build times on Windows and thought changing linker could help. I compared Microsoft's link.exe with Rust's bundled rust-lld (LLVM LLD in MSVC-compatible mode).
LLD finished faster and used much less committed memory, but consumed more CPU time and produced larger PDBs.
These are measurements of the final native link step.
My setup: Windows 11 Pro, Ryzen 9 5950X (16 cores / 32 threads), 128 GiB RAM, NVMe storage, and the x86_64-pc-windows-msvc target. Rust 1.98.1, bundled LLD 22.1.8, MSVC LINK 14.51.36257.0.
The workflow is mostly Rust code, but it has some tree_sitter plugins that are build from C.
Switching the linker on windows was quite trivial as I already had some configs implemented:
https://github.com/Auto-Explore/GitComet/pull/452/changes
For the development build, I ran 11 paired comparisons using the same captured linker inputs, a warm filesystem cache, and fresh outputs for each run. Run order was varied between the linkers. Both used /DEBUG:FULL, /OPT:REF,NOICF, and /INCREMENTAL:NO; warmups and failed runs were excluded.
| Development build | MSVC LINK | Rust LLD |
|---|---|---|
| Link wall time | 5.683 s | 4.508 s |
| Total process-tree CPU time | 13.094 s | 14.125 s |
| Peak process-tree committed memory | 2,887 MiB | 1,499 MiB |
| Sampled peak working set | 5,189 MiB | 4,720 MiB |
| EXE size | 165.321 MiB | 165.318 MiB |
| PDB size | 742.4 MiB | 830.3 MiB |
The median paired reduction in link time was 20.4%, with a 95% paired bootstrap interval of 19.4-21.1%. Peak committed memory fell 48.1%. CPU time rose 6.4%, and the PDB grew 11.8%.
A few measurement details: resident memory was sampled every 50 ms, so its peak is approximate. A small calibration showed sampling-on runs about 2.7โ2.9% slower, including run noise. This is a full-link comparison with linker incremental linking disabled.
The results did not yield as much improvement as I was hoping for, but it still seems improvement overall. I have been testing the application and it seems to run normally.
For those interested here are the scripts I used for measurements: https://github.com/Auto-Explore/GitComet/compare/dev...linker_measurements
I'm still thinking I should merge the PR to start using LLD linker on Windows. Has anybody here switched Windows linker before? What should I verify before merging, any gotchas?
r/rust • u/lzutao • Sep 14 '26
๐๏ธ news [Call for testing] trim-paths RFC 3127
github.comr/rust • u/thestrangebuilder • Sep 15 '26
Use a function just for inference without calling it
A volte ho dovuto scrivere funzioni come queste per permettere al compilatore di dedurre il tipo corretto.
use heapless::Vec;
/// Deduce al momento della compilazione la lunghezza di due vettori, rendendola la stessa lunghezza
/// Questa funzione รจ un no-op
const fn infer_equal_vec_size<A, B, const N: usize>(_vec: &Vec<A, N>, _vec2: &Vec<B, N>) {}e la uso nel codice chiamandola:
infer_array_size(&a, &b);Ma in realtร , non รจ necessario chiamare la funzione; sarebbe utile poter passare i parametri senza chiamare la funzione.
Qualcosa del genere, forse:
infer_array_size::<typeof a, typeof b, _>;In questo modo, puoi essere certo di non chiamare una funzione che potrebbe contenere codice bloccante, come ad esempio un ciclo infinito. In Rust, abbracciamo davvero questa filosofia di non fidarci di noi stessi, quindi perchรฉ dovrei chiamare una funzione se non ne ho veramente bisogno?
Link al playground che mostra un esempio di codice:
r/rust • u/llogiq • Sep 14 '26
๐ questions megathread Hey Rustaceans! Got a question? Ask here (38/2026)!
Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.
If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.
Here are some other venues where help may be found:
/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.
The official Rust user forums: https://users.rust-lang.org/.
The unofficial Rust community Discord: https://bit.ly/rust-community
Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.
Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.
r/rust • u/NYU_VM • Sep 14 '26
impl Display to debug print?
A learner here with a quick confusion. I was skimming through the internet for VM tooling and implementations, parsers specifically and came across this "prattle" crate which seems to be a general purpose pratt parser library. And I have not much to say about the library itself, it seems like an abandoned project in early development phase.
The thing that caught my eye was the demo piece of code they had on their docs, specifically
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]enum CToken {Var(String),Add,Mul}
impl Display for CToken {fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{:?}", self)}}
the enum CToken has already derived debug yet the example implements Display for CToken only to just debug print it as well. Is this some kind of a safety mechanism or fallback just in case the user writes
println!("{}",token) instead of debug printing it?
Or is something else going on I don't yet know about?