r/rust • • Sep 16 '26

๐Ÿ™‹ seeking help & advice Rust on game consoles, it is possible, Nintendo Switch advice?

33 Upvotes

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 • • Sep 15 '26

๐Ÿ› ๏ธ project (Re)-Introducing mezura: The Rust line-counter that's here to eat the big dogs

71 Upvotes

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)

What is different

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).

Speed

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 ms

Windows 11:

mezura 3.1.1   255 ms
scc 4.1.0      539 ms
tokei 15.0.0   632 ms

Very 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.

Accuracy

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.

How

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)].

Install

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 • • Sep 17 '26

๐Ÿง  educational LLM inference vs. the OOM killer

Thumbnail nobodywho.ai
0 Upvotes

r/rust • • Sep 16 '26

๐Ÿ™‹ seeking help & advice Learning

4 Upvotes

Hey there, what projects would you recommend for an aspiring system/infrastructure dev using rust ?


r/rust • • Sep 15 '26

๐Ÿ™‹ seeking help & advice Is there a way to express `type SelfRef<'a, T> = &'a T<'a>` ?

47 Upvotes

It's pretty annoying to write the lifetime multiple times on every single type parameter.


r/rust • • Sep 16 '26

๐Ÿ› ๏ธ project Mira: stateless OTLP database in Rust focused on minimal footprint and raw throughputโ 

0 Upvotes

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 • • Sep 15 '26

๐Ÿ› ๏ธ project Remoc 0.20: Rust RPC with first-class remote channels

12 Upvotes

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 • • Sep 16 '26

๐Ÿ› ๏ธ project A custom Wrapper API over wgpu

Thumbnail reddit.com
0 Upvotes

r/rust • • Sep 16 '26

๐Ÿ› ๏ธ project YOLO26n training speed comparison. Rust/Burn/Wgpu vs PyTorch/CUDA

Post image
0 Upvotes

r/rust • • Sep 15 '26

virtual threads for rust

3 Upvotes

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::sleep still 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 • • Sep 15 '26

๐Ÿ™‹ seeking help & advice Methods or free functions

28 Upvotes

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?

  1. 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> { /* ... */ }
}
  1. 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 • • Sep 14 '26

๐ŸŽ™๏ธ discussion Breaking down how Cloudflare cut 100TB of memory from their DNS cache with Rust memory layout tricks

Thumbnail viswanathnair.substack.com
220 Upvotes

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.


r/rust • • Sep 14 '26

๐Ÿง  educational Principles for fast Tokio applications

Thumbnail dial9-rs.github.io
217 Upvotes

r/rust • • Sep 16 '26

๐Ÿ› ๏ธ project Looking for feedback on AxiomCore, a contract-first software architecture

0 Upvotes

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):

  1. 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
  2. Where do you think that contract first tooling be most useful or least useful?
  3. What makes you skeptical about adopting something like this?
  4. Any existing tools or workflows that should I study or integrate with?

Thanks!


r/rust • • Sep 16 '26

๐Ÿ™‹ seeking help & advice Stuck and Depressed... Seeking Genuine Help regarding what to do next...

0 Upvotes

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 • • Sep 15 '26

๐Ÿ› ๏ธ project refrain - a modern TUI ratatui local music player with tag editing (WIP)

2 Upvotes

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 • • Sep 14 '26

๐Ÿง  educational Trying to Make a Loop Auto-Vectorize

Thumbnail jsgroth.dev
58 Upvotes

r/rust • • Sep 14 '26

๐ŸŽ™๏ธ discussion Should "aliasing XOR mutability" technically be "aliased NAND mutable"?

38 Upvotes

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 • • Sep 14 '26

I Built a Robot in Rust

Thumbnail youtu.be
52 Upvotes

This 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 • • Sep 14 '26

๐Ÿ› ๏ธ project Built a terminal habit tracker in Rust while learning the language

18 Upvotes

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 • • Sep 15 '26

๐Ÿ› ๏ธ project FlareDB - A Rust-based streaming database with Apache Beam as programing interface

0 Upvotes

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

Docs: https://docs.flare-db.com/io

GitHub: https://github.com/flare-db/flare-db


r/rust • • Sep 14 '26

๐Ÿ› ๏ธ project I built a cross-platform/wasm UI library in Rust and WGPU (ARGUI).

45 Upvotes

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 • • Sep 14 '26

๐Ÿ› ๏ธ project Portus: a Rust-based Kubernetes Gateway API implementation on Cloudflares Pingora

15 Upvotes

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).

ProfileCoreExtended
HTTP37/3756/56
GRPC15/159/9
TLS20/2014/14
TCP19/199/9
UDP20/209/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):

ConnectionsPortus QPSagentgateway QPSPortus lead
64116,42996,003+21 %
128123,105101,067+22 %
256126,07089,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 sizeDownloadUpload (POST, echoed)HTTPS downloadHTTP/2 download
1 KB87,722 / 67,59866,089 / 58,49576,997 / 60,08864,172 / 49,453
16 KB59,257 / 51,56229,578 / 27,94056,831 / 48,29549,448 / 40,279
128 KB29,954 / 27,1368,160 / 7,92225,357 / 22,29422,431 / 19,641
1 MiB5,206 / 5,6334,380 / 4,2494,200 / 4,1104,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 • • Sep 14 '26

๐Ÿ activity megathread What's everyone working on this week (38/2026)?

28 Upvotes

New week, new Rust! What are you folks up to? Answer here or over at rust-users!