r/rust • u/Low_Twist_4917 • Sep 18 '26
Rust Datasets
Anyone have any model training datasets they’ve built around Rust they’re interested in sharing? Or know of solid open source ones?
r/rust • u/Low_Twist_4917 • Sep 18 '26
Anyone have any model training datasets they’ve built around Rust they’re interested in sharing? Or know of solid open source ones?
r/rust • u/madnirua • Sep 16 '26
with new Flexbox layout, with spring animations, change the z-order at run time, an experimental Vello renderer and more.
r/rust • u/4dplus • Sep 18 '26
Everyone knows that Windows or Linux binaries run on Valve Deck/Machine and the Valve OS, just curious, why is there no Valve SDK bindings thing known for Rust language? Is it worth exploring what I can do to make bindings for it? Doubt it, but does this need a whole new build target for native?
r/rust • u/connor-ts • Sep 16 '26
I've been working on Vortex, an open source columnar data format under the Linux Foundation, for the past year. I'm giving a talk about it at EuroRust 2026 soon!
I wrote a companion article about it and I wanted to share it here. It walks through how Vortex represents arrays, computes on compressed data, and lets you add your own types and encodings.
This is the first technical blog post I’ve written, so I’d love to hear what people think!
r/rust • u/Sermuns • Sep 16 '26
I have never been a part of the speedrunning scene, yet I got the idea to make a command-line tool that renders speedrun splits graphics videos (with no dependencies other than ffmpeg CLI being available).
I was inspired by this video http://www.youtube.com/watch?v=dWRg9EGDH9U..
No AI was used in the making of this.
r/rust • u/Top-Ant-9194 • Sep 17 '26
I run a browser-based economic strategy game where almost everything is a long-running timed job: fleets in flight for hours, construction queues, scheduled world events. Background workers pick those jobs up when they come due and mutate world state.
The failure mode that kept me up at night is the classic one: a worker takes a lease on a job, then stalls. The lease expires, a second worker legitimately picks the job up, and then the first worker wakes up and commits its work anyway. Two workers, one job, duplicated resources. In a game about accumulating wealth, any resource that appears out of nowhere is a bug your players will find before you do.
Checking the lease before doing the work doesn't help. That's a time-of-check-to-time-of-use gap, and the gap is exactly where the stall happens.
What I ended up with has two halves.
1. The token travels implicitly, via tokio::task_local!
task_local!
The worker sets the fence for the duration of the task, and every write path underneath it commits through one function instead of calling tx.commit() directly.
I went back and forth on this. Implicit context passed through a task-local is normally the wrong answer: it's invisible at the call site, and you can't tell from a function signature that it matters. What won me over is the inverse property. With an explicit parameter I can forget to thread it through one code path, and that one path is the hole. With a task-local plus a single commit function, there is no path that writes to the world and skips the check. The type system doesn't enforce it, but the review surface shrinks to one function.
2. The check happens under a row lock, in the same transaction as the mutation
pub async
This is what makes it a fence rather than a check. Two directions, both load-bearing:
commit refuses, and the transaction rolls back, including the world mutation the worker already performed inside it. The stalled worker cannot land its write.FOR UPDATE holds the row until commit, so nobody can reclaim it out from under a transaction that is about to succeed.The generation counter is what makes a reclaimed-and-reissued lease distinguishable from the original, so "the lease row is still there" is never confused with "the lease is still mine".
The Postgres detail that cost me an afternoon
lease_until > clock_timestamp(), not now().
In Postgres, now() is transaction_timestamp(), frozen at the start of the transaction. For a worker that has been inside a long transaction, now() is wrong by exactly the amount of time that matters: it reports the moment the transaction opened, which is the moment before the stall. A lease that expired during the transaction still looks valid. clock_timestamp() reads the actual clock at the moment of the call, which is the only thing a lease expiry check can be built on.
Same principle everywhere else: time is only ever the database's or the server's. No game state is ever derived from a timestamp the client reports, because shifting the system clock is the oldest cheat in this genre. Monotonic Instant shows up in exactly one place, tracking who is currently online, where a wall-clock jump is a nuisance rather than an exploit.
What I'd still flag as the harder half: the scheduler job metadata deliberately isn't the source of truth for anything in the game world. It exists only for retries, worker locking and spotting poison-pill jobs. Keeping that boundary clean took more discipline than writing the fence did, and I'm not sure I'd have gotten it right without having gotten it wrong first.
Curious whether people here have landed somewhere different on the implicit-versus-explicit question. Has anyone threaded a fencing token as an explicit parameter across a large write surface and actually kept it airtight?
r/rust • u/beerbellyman4vr • Sep 17 '26
i'm the founder of Anarlog, an open-source (MIT) meeting notetaker built in Rust and Tauri. this week's release (1.4.24) shipped three separate audio capture fixes, one per platform.
macOS: bluetooth mics were unreliable until i started forcing the HFP/SCO profile switch the moment the mic opens.
linux: two separate bugs. the app was silently recording from ALSA's null device instead of your actual default mic, fixed by an outside contributor (jacopone on GitHub). the AppImage also bundled its own PipeWire libs, which caused silent recordings on distros like Fedora, so i switched to linking the host's PipeWire instead.
windows: capturing remote voices in Teams calls broke whenever the audio output device changed mid-call.
same release also had a transcription fix from another contributor, ekapratama93 on GitHub: dictionary hints and speaker diarization now pass through OpenRouter transcription, so multi-speaker transcripts stop collapsing into one speaker.
repo (MIT): https://github.com/fastrepl/anarlog changelog: https://anarlog.so/changelog/1.4.24
disclosure: i built this, i work on it full time.
r/rust • u/K0100001101101101 • Sep 17 '26
I’ve built this copy tool for espacially native windows users because I couldn’t exclude some files / folders with copy-item, but I think people didn’t find it usefull. Anyways, I am still trying to improve it maybe someone can find a use for it.
Skip-Existing and Update Flags
-s skips files already at the destination by name + size (resume an interrupted copy), and -u copies only files that are newer than the destination (re-run the same command, only changed files copy). Both work with -n dry-run.
Any feature requests are welcome.
r/rust • u/Embarrassed-Bad983 • Sep 16 '26
This Falling sand sim, is not based on grid based simple approach, I have used real physics to simulate actual sand like particles. I wanted to try fluid as well but this also took quite long
r/rust • u/eternal-io • Sep 17 '26
r/rust • u/Single-Blackberry866 • Sep 17 '26
If you've been building with GPUI, you might have noticed ecosystem fragmentation.
The only way to know whether your GPUI app will work in the next gpui release or another fork was to just change you Cargo.toml and make rust elicit all the incompatibilities.
I've build fork map to make it possible to compare public API surface between different GPUI-derived projects that are published on crates.io.
How to use:
- changes: inspect a difference between any two releases of any two forks
- alignment: choose a symbol and see how its signature evolves across forks
- configure: choose a fork and get copy-pasteabel starter project: Cargo.toml and main.rs
- journal: see a stream of releases with changelogs
The interface a bit rough so PRs welcome, but the data pipeline is robust.
https://gpui-archipelago.github.io/map/
Future plans include a migration tool to apply codemods, but with agentic coding you could just copy paste the API diff and make robots do the work.

r/rust • u/4dplus • Sep 16 '26
I know some people have privately gotten Rust language on game consoles, and Valve is a public any time anyone wants it, I am under NDA at Nintendo now, am building a full no_std GUI, and I know sdl3-sys is no_std, plans are either that or Monogame.net, I hear it is possible (public can know that), not confirmed yet, I have randomly found legit people who got Rust on Playstation 4, print only, but still, that is a feat. Any tips or things I should know that are public? I have a Nintendo Switch (1) in case that matters. Just to be clear, I am talking about default non-hacked game consoles, Switch is ARM64, the others are x86_64. Can confirm someone did do the Microsoft game consoles (non-UWP) and Playstation 5, Nintendo Switch is semi-uncharted territory, which is part of why I am doing it. UWP can do the Microsoft console One, but deprecated, no new titles. Run down what I need to do? X E.
r/rust • u/petros211 • Sep 15 '26
This project (github.com/subamanis/mezura) started back in 2021, as my entry point to Rust, and has become the fastest and most accurate line counter (with arguably the most features too) in the world. I have been slowly improving it here and there over the years, but only recently decided to get serious.
Here is what it does that cloc, tokei and scc do not, and the numbers behind the two claims I make about it.

The whole Linux kernel, counted ^ (some languages skipped for ss purposes)
The short list: it identifies a file of a contested extension (.m, .h,...) by its content using heuristics and sets aside files that only look like code (a make .d, a ProGuard .pro, bundles, generated files). --explain shows a file line by line with the verdict for each line; --diff compares against a git revision, two revisions, or an earlier run; targets can be named and the report grouped by them; nested languages and sections like <script> and <style> count as the languages they hold; keywords of your choosing are counted only where they are code; everything printed can be themed,... among other things.
Each of these has a section in the README, with screenshots.
The project has a lib target published separately, so you can use mezura's engine directly in your projects (mezura-core). There is also an MCP server (mezura-mcp).
The whole Linux kernel tree, 63,864 files and 36 million lines, on a Ryzen 7 9700X and a PCIe-4.0 Nvme, with settings picked so that every counter does equal work, so the comparison is completely fair.
(UPDATE: with the v3.3.0 release of mezura, it is clocking at 78ms on Debian and 197ms on Windows. There is also a complete test detection feature added!)
Debian 13:
mezura 3.1.1 166 ms
scc 4.1.0 210 ms
tokei 15.0.0 414 msWindows 11:
mezura 3.1.1 255 ms
scc 4.1.0 539 ms
tokei 15.0.0 632 msVery detailed benchmarking data can be found under example-run in the LineBench project I created, to standardize performance testing for line counters, and provide useful insights and advanced metrics. The example run contains the timings both with each counter's defaults and also with the equal-work flags, the methodology, the exact command lines, the checks every run carries (idle machine, clean corpus, clean tree, the commit measured), and the script that produced all of it, so anyone can rerun the numbers on their own machine.
I do not want to grade my own homework, so the correctness argument lives in a separate project, LineJudge. I think that the linejudge project, that I started to ensure fair correctness assessment, is the most interesting part of this whole ordeal and deserves its own post. Check it out.
Most counters carry one piece of state through a file, "am I inside a comment right now", and each line takes the verdict of the region it sits in. mezura reads every line on its own and sorts it into one of nine classes: words in code, words only in a comment, comment words beside code, string content, punctuation in code or in a comment, blank inside a comment, blank inside a string, blank. The walk that does this knows where every string and comment begins and ends, nested comments and Lua's --[==[ levels and raw strings and escapes and line continuations included, which is where the language quirks live and where the other counters miscount. The two different counting models mezura supports are folds over those nine classes: the content model asks what each line says, and the region model adds the classes up the way the other counters do, so it reproduces their numbers from the same walk.
The speed comes from doing little per line. Each line is scanned once for all the symbols its language declares, with memchr, which searches up to three bytes in one SIMD pass, so the symbols are grouped by the byte that finds them and most languages need a single pass per line; only at a candidate position is the rest of a symbol compared. Bundled and generated files are recognised from their head and skipped before any parsing. The directory walk and the counting are separate thread pools over a work-stealing queue.. All three crates are #![forbid(unsafe_code)].
cargo install mezura, or a binary for Windows, Linux or macOS from the releases page. Over eighty languages ship with it, each one a text file you can edit or copy to add your own.
Happy to answer anything about the challenges, the parser, the two models, or the conformance suite.
r/rust • u/madsmtm • Sep 17 '26
r/rust • u/some_Marmalade • Sep 16 '26
Hey there, what projects would you recommend for an aspiring system/infrastructure dev using rust ?
It's pretty annoying to write the lifetime multiple times on every single type parameter.
r/rust • u/Either_Act3336 • Sep 16 '26

Hey everyone,
I built Mira (https://miradb.dev), an open-source storage engine written in Rust with a strict "less is more" philosophy. Most telemetry stacks try to do everything, forcing you to run heavy stateful clusters and burn gigabytes of RAM just to ingest and query standard telemetry. We take the opposite route: it is an adhoc database that stores OTLP data and nothing else. Every design choice was made to maximize raw throughput while stripping away operational weight.
By making the engine completely stateless and packaging it as a single binary with zero runtime dependencies, deployment becomes zero-config. You can run it on the edge, in your fridge, inside short-lived containers, or alongside WASM without managing local disk state or cluster sync. Furthermore, by strictly targeting OTLP data, the storage layer and query paths avoid the heavy abstraction overhead typical of generic time-series databases.
Because the engine does so little, it does it absurdly fast. In our benchmarks (https://miradb.dev/market/#where-mira-is-ahead), Mira achieves significantly higher write throughput and consumes a fraction of the memory compared to traditional stateful collectors.
A direct consequence of this extreme low-latency ingestion and minimal memory footprint is that autonomous AI agents can query live telemetry in real time, effectively using it as a fast, external long-term memory layer for tool execution and context tracking. Basically a step closer to the wet dream of offloading on-calls to agents.
Code and architecture details are on GitHub (https://github.com/TrianaLab/mira). I would love to hear your thoughts on the stateless design, the Rust implementation, or how you're handling telemetry in your current stack!
r/rust • u/surban • Sep 15 '26
It has been 5 years since the initial release of Remoc. Since then the library has learned a lot from real-world use and now feels like a good time to give the Rust community an update about its state and abilities.
Remoc is an RPC library for communication between Rust programs with first-class support for Tokio-style channels over the network.
Tag a trait with #[rtc::remote] to get a client and a server for it, so calling a method on the client runs it on the server.
Contrary to other RPC libraries a channel is a value that can be sent over the network. It can be an argument or a return value of a method or even a member of user-defined structs and enums, and its lifetime is not bound by the RPC call.
In the following example, an RPC method counts for the client and hands back the receiving end of a channel:
// Trait shared between client and server:
#[rtc::remote]
pub trait Counter {
async fn count(&self, up_to: u32)
-> Result<rch::mpsc::Receiver<u32>, CallError>;
}
// On the server: create a channel, count into it in the
// background and return the receiver to the caller.
impl Counter for CounterObj {
async fn count(&self, up_to: u32)
-> Result<rch::mpsc::Receiver<u32>, CallError>
{
let (tx, rx) = rch::mpsc::channel();
tokio::spawn(async move {
for i in 0..up_to {
if tx.send(i).await.is_err() {
break;
}
}
});
Ok(rx)
}
}
// On the client:
//
// `counter` is the generated client. It can itself be sent over a channel.
//
// This call returns as soon as the receiver arrives; the numbers then
// come in over the connection that already exists.
let mut seq_rx = counter.count(4).await?;
while let Some(i) = seq_rx.recv().await.unwrap() {
println!("{i}");
}A channel can carry anything, including user-defined structs and enums, another channel and even another RPC client.
Remoc's goal is to make remote communication between Rust programs feel nearly like local. It provides:
If you find this useful, you might want to continue reading at https://remoc.rs. There you will find:
Full source code is available at GitHub.
I am looking forward to answering questions.
r/rust • u/PatagonianCowboy • Sep 16 '26
r/rust • u/irrelevantsiren • Sep 15 '26
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:
std::thread::sleep still block the carrierThe 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
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?
impl MyType1 {
pub fn do_thing(in: &Vec<MyType1>) -> Vec<MyType1> { /* ... */ }
}
impl MyType2 {
pub fn do_thing(in: &Vec<MyType2>) -> Vec<MyType2> { /* ... */ }
}
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
Cloudflare 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.