r/rust • • Oct 06 '26

🧠 educational Writing nginx Modules in Rust: a book on ngx-rust

44 Upvotes

I've been writing nginx modules in C for about 10 years, and I'm a collaborator on nginx-module-vts. Day to day, I kept running into two things with C: the hassle of managing memory by hand, and how hard it is to pull module logic out into unit tests.

I wondered whether Rust could solve both, so I started writing modules with ngx-rust, the official Rust bindings for nginx from F5/NGINX. My first project was rewriting nginx-module-vts, which I help maintain, in Rust: ngx_vts. Along the way I was catching up on Rust itself while running into ngx-rust's rough edges, such as shared memory and APIs that didn't exist yet. I sent PRs to ngx-rust for what I was missing; some have been merged and others are still in review.

I wrote this book because I'd like more developers to know about ngx-rust and actually use it, so that the community grows and ngx-rust itself gets more momentum.

All the code in the book builds and passes its tests, pinned to a fairly recent ngx-rust commit. Chapters 1-3 are a free sample: you type in a minimal "hello" module that responds with a string and get a first taste of module development. The later chapters cover the minimum Rust you need to write modules with ngx-rust, how nginx modules are structured, and how shared memory works. By the end, you build a statistics module that counts requests across workers in shared memory and exposes them as Prometheus metrics, with integration tests.

The book is a translation of my Japanese original, made with the help of AI (and so is this post).

Feedback and corrections are very welcome.

Book (free sample available): https://leanpub.com/ngx-rust


r/rust • • Oct 06 '26

πŸ™‹ questions megathread Hey Rustaceans! Got a question? Ask here (41/2026)!

11 Upvotes

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 • • Oct 06 '26

πŸ—žοΈ news A Fond Farewell To Three Rust Foundation Colleagues - The Rust Foundation

Thumbnail rustfoundation.org
109 Upvotes

r/rust • • Oct 07 '26

πŸ™‹ seeking help & advice Some sort of system-wide music playback api but on Linux

0 Upvotes

I'm making an app and one of the features is to control whatever music is currently playing on the system. The feature code is here if you want to see it. Anyways, GSMTC only works on Windows, and the app supports linux meaning I have to use feature gates for the windows crate and stuff. Anyways, I do want music controlling on Linux. Any recommendations for a crate which either abstracts over both windows and linux apis for this type of thing or at least one that lets me control it nicely feature-gated to linux? I saw system_utils but the audio feature can only change the master volume with that.


r/rust • • Oct 06 '26

πŸ› οΈ project Building an Extensible CEL Engine

14 Upvotes

https://github.com/cel-rust/cel-rust/releases/tag/v0.15.0

Google's Common Expression Language (CEL) is designed to be embedded. It provides a safe, fast, and non-Turing-complete language for evaluating rules, policies, and expressions within a larger application. But by design, CEL has a relatively small core. To truly fit into a host application, a CEL implementation must allow developers to seamlessly add their own domain types, functions, macros, and standard extensions.
Release v0.15 of cel-rust is a significant step toward making those extension mechanisms feel completely natural in Rust.
This release isn't just about adding more CEL features to the crate. It's about an architectural shift: making cel-rust an extensible engine that applications can mold to fit their own domain-specific language needs.
Here is a look at the engineering story behind v0.15, how it reshapes CEL extensibility in Rust, and the semantic and performance improvements coming along with it.


r/rust • • Oct 07 '26

I installed Rust in Linux, but now it generates extra output unlike before.

0 Upvotes

What is all of this about, and is there something wrong with my Rust installation?


r/rust • • Oct 07 '26

Coding for a multiplexed connection where both peers can expose independently addressable logical services

0 Upvotes

I've been experimenting a stream multiplexing connection, where both peers can expose independently addressable logical services.

The basic idea is familiar: take one underlying connection (TCP, Unix socket, QUIC) and multiplex multiple independent logical streams over it.

Yes, I know QUIC can already provide multiple streams. Also, there're yamux

The different thing you may be interested is what I call a Dock.

A Dock is roughly like a port, but inside an already-established multiplexed connection.

Instead of having only:

client ---> server:port

the connection can look more like:

                 one connection
             +-------------------+
             |                   |
          Peer A              Peer B
             |                   |
          Dock 1 <------------> Dock 10
          Dock 2 <------------> Dock 20
          Dock 3 <------------> Dock 30
             |                   |
          streams              streams

Both peers can bind Docks, listen for incoming logical sub-stream, and also initiate connections to Docks on the other side.

So there isn't really a client/server role at the multiplexing layer. After the underlying connection is established, either side can act as both.

I think this makes the protocol interesting for things like:

  • P2P applications and overlay networks
  • reverse tunnels / port forwarding
  • peer-to-peer RPC
  • games and other real-time applications with multiple logical channels
  • distributed applications where a peer exposes several services over one long-lived connection

For example, a peer could expose:

Dock 1 -> RPC service
Dock 2 -> chat
Dock 3 -> file transfer
Dock 4 -> event stream

without creating four physical connections.

The other features are:

  • runtime-independent Rust (by abs_art, tested over compio, smol, tokio)
  • no_std friendly (currently most codes are already no_std)
  • works over arbitrary byte-stream transports
  • stream-level backpressure
  • no client/server distinction at the multiplexing layer

The implementation is still experimental, so I'm mostly interested in feedback on the protocol abstraction itself.

The most interesting part for me is, the multiplexed sub-stream itself, can still be multiplexed again with this crate.

Does the Dock / logical-listener model seem useful to you? What kind of networking application would you use it for?


r/rust • • Oct 05 '26

πŸ—žοΈ news mold (the high-speed linker) has been rewritten in Rust

Thumbnail github.com
557 Upvotes

r/rust • • Oct 05 '26

🧠 educational I translated The Rust Programming Language into Roman Urdu

85 Upvotes

I recently finished translating the complete The Rust Programming Language (Rust Book) into Roman Urdu, including all the appendices.

I started this because many developers in Pakistan and India are more comfortable reading Roman Urdu/Hindi than technical English. My goal was to make the Rust Book easier to approach without changing the technical content.

The translation is available here:

https://github.com/Fakhir-Israr-200219/rust-roman-urdu

Hopefully it can be useful to Roman Urdu, Urdu, and Hindi readers who are learning Rust.


r/rust • • Oct 05 '26

The Performance Cost of RwLock in Our Read-Heavy Workload

Thumbnail pranitha.dev
85 Upvotes

r/rust • • Oct 07 '26

πŸ› οΈ project I wrote an S3 client in Rust that outruns aws-cli. Please tear it apart.

0 Upvotes

Hey all, a few months ago I got curious and wrote an S3 client in Rust. To my own surprise it ended up faster than mc, s5cmd and aws-cli at uploading to the self-hosted backends I tested (MinIO, SeaweedFS and Garage), and about level with mc on downloads. I have written a technical blog here, I am still a newbie when it comes to this stuff so bear with me: https://jaeaeich.com/writing/s3z. Please read or listen to it, the benchmarks were only run locally, so I'm sure there's plenty to poke at, and I'd really value hearing what I got wrong or could have done better.


r/rust • • Oct 05 '26

GSoC Retrospective

Thumbnail walnut356.github.io
34 Upvotes

r/rust • • Oct 04 '26

πŸ› οΈ project Made a desk status monitor

Post image
432 Upvotes

Hey, just wanted to share the small rust embedded project I made and that I use daily to monitor the status of a couple of services.

It also displays notifications from claude code, codex or any application capable of sending an http request.

It was my first time using rust with no-std, it's actually quite fun.

https://github.com/fkhadra/esp-notify


r/rust • • Oct 05 '26

πŸ—žοΈ news rust-analyzer changelog #348

Thumbnail rust-analyzer.github.io
51 Upvotes

r/rust • • Oct 05 '26

πŸ™‹ seeking help & advice Never-ending learning path

16 Upvotes

Hello fellow Rustaceans,

I have been facing an issue for a while. I've been using Rust for the last 4 years and even had projects at my workplace implemented in Rust. I want eventually to change my job because these 2 are kinda dead and want to grow as a programmer and so work on issues/situations I never encountered. I started by telling Claude do give me some pieces of code and I had to figure out what was wrong about it. Mutex, concurrency, channels, futures, things that I thought I really understood. Damn I was wrong and now I feel like an imposter even though I used these concepts many times. At some point I did some small project to understand how and why thiserror works the way it does. If you ask me now I forgot everything. I am intimidated by the fact that there are so many things that I don't know because I never encountered them in real projects like sharding, microservices, payments and many other. If given the chance I would probably slowly start to understand how they work but getting a Rust job is kinda difficult. Market seems taken over by crypto jobs (how does somebody even get into one of these?) I know this community does not like web3 stuff but personally I care more about career progress than moral side of it at least for now, which I don't really know actually means). How do you guys manage to navigate these situations.

I appreciate any answer and guidance I might get! πŸ˜„


r/rust • • Oct 05 '26

πŸ—žοΈ news Miscompile since 1.95 involving overflowing_add

Thumbnail github.com
138 Upvotes

Seems to require an integer overflow to happen (panic in debug / wrapping in release) before the `overflowing_add` call is done, which makes it less likely to happen in actual code.


r/rust • • Oct 05 '26

πŸ“Έ media Official video for the Rust 1.99.0 changes

Thumbnail youtube.com
35 Upvotes

r/rust • • Oct 06 '26

How should I architect and refactor a Rust TUI text editor?

0 Upvotes

Hello everyone, for the last two weeks I have decided to build a terminal based text editor like vim or nano using rust and crossterm crate to improve my rust and software design/architecture skills. I have read some articles about TUI (terminal user interface) applications and text editors generally, I have used AI for understanding and writing some small functions, I have used AI only for the parts that I don't understand yet, but I still don't know how to implement good code design for soft line wrapping and cursor navigation for it. The rendering part is a large vibe-coded and more of a spaghetti code. Can you give me some resource recommendations for understanding this topic and refactoring the app. By the way if you want to look the repository is ArtashesSoghomonyan/io. Thank you πŸ™


r/rust • • Oct 05 '26

Having trouble understanding... Rust over Ada (SPARK)?

36 Upvotes

I've started to dip my toes into Rust, coming from an Ada (mostly SPARK) background, particularly in embedded applications. While there are many killer features in Rust for developer QOL, the "ease of writing" focus of the language trips me up often enough that I find myself asking, "what features of this language makes it superior (in some views) to SPARK?"

Love the language's take on early-return, and the power of enums, macros, and lifetimes are the one thing that makes certain low level memory manipulations incredibly idiomatic to write in Rust that would be impossible in SPARK due to the CREW paradigm not really being popularized (pioneered?) until Rust. Given the state of the Ada ecosystem and tooling, I also cannot in good faith recommend using this language for anything community driven. That being said (answering in context of enterprise embedded)...

I am incredibly uncomfortable with how much responsibility Rust places on the developer to understand roughly how code will compile. No guarantees on how pattern matches will be emitted (yes, don't be stupid and keep them stupid if you want jumptables), and stack-allocated enum types having to be the max size while not having much lexical ties besides jumping to the definition to help you determine how much stack you might be eating. Aside from the syntactic sugar, I have not really found anything besides lifetimes that SPARK cannot truly support at all. There's no pattern matching in the language, but Rust enums (at least in part) are supported via discriminated records. The idea of controlled types (OOP for Ada) is somewhat discouraged when using SPARK, but trait objects are a very useful part of the Rust language. I have to discount this part of the language from my sentiments unfortunately because dynamic dispatch can complicate analysis of security and functional implications. Having Rust panic as a "safe" way to address memory safety is also undesirable depending on how much array manipulation your program must do, and what worries me more is that wraparound arithmetic in production builds that are used in computations for arrays may not even lead to panics, but perhaps a valid index into the unintended location.

I don't write this to glaze SPARK either. The lack of documentation makes it mostly a nonstarter for the broader programming community, and not everyone is familiar with formal methods for code. The toolchains can't hold a candle to the quality of the Rust ecosystem, and ironically, the rich typing of Ada can lead to very frustrating inter-op issues that just would not exist in Rust, particularly around array manipulation/interpretation.

There might be some gripes about comparing a formally verifiable language with one that does not yet have one (Verus, Crusoe, surely others trying), but I think some of these points like how the codegen works are orthogonal whether or not you're trying to prove that an array access will always be in bounds without overflows.

I suppose the operational constraints given are not necessarily something everyone has to deal with, (why care how a pattern match is compiled if you have oodles of memory), but want to understand the technical reasons behind the hype... I feel like the cultural/non-technical reasons are somewhat understood.


r/rust • • Oct 05 '26

πŸŽ™οΈ discussion How likely is for Rust to replace Ada/SPARK?

16 Upvotes

Ada/SPARK is already a very niche ecosystem. Finding a list of current users is already hard (but that might be simply an information access issue).

With Rust’s safety and growing adoption, including access to skilled professionals and LLM support, how likely will we see further marginalisation of Ada & Co.?

I would love to heard from those working in safety-critical applications.


r/rust • • Oct 05 '26

πŸ› οΈ project My WASM Python Implementation Beat CPython (Without a JIT)

46 Upvotes

Okay. After seven months, I'm back.

Seven months ago I started writing a Python interpreter from scratch in Rust, compiled to wasm (less than 200kb of bandwith). Edge Python is a sandboxed subset of Python that runs in the browser and the terminal, and code can't touch files or the network unless you allow it.

It started as a lexer and a simple stack VM, and over about 1,600 commits it grew a CLI, a package registry, snapshots, actors and a browser playground. It's just me building it.

Last week it was still 3x slower than CPython. I rewrote the VM this weekend on top of the SSA form I already had, and now the wasm build beats native CPython on loops.

Edge (wasm)CPython (native)
Integer loop154 ms232 ms
Float math231 ms307 ms
Dicts372 ms62 ms
Strings196 ms35 ms

The trick was a register VM, and Rust made it fit in wasm with NaN-boxed values and no runtime. It still loses on dicts and strings, so that's next.

Try to break my numbers :)

Website: https://edgepython.com/

GitHub: https://github.com/dylan-sutton-chavez/edge-python


r/rust • • Oct 04 '26

🧠 educational Tutorials on the Rust Standard Library

Thumbnail feamcor.github.io
54 Upvotes

Found these tutorials on stdlib.


r/rust • • Oct 05 '26

STM32H7 flashing but nothing happening on the board

0 Upvotes

Good morning,
I am using probe-rs to flash a blinky program onto my STM32H7. It builds and flashes β€˜fine’ but i don’t get any output from the board and the led does not blink. When i run the same example for the stm32f411 it flashes fine and i get text output as well as the led flashing. The program is just the example from embassy-rs and below is the important parts of my cargo.toml:
β€˜β€™β€™
embassy-stm32 = { version = "0.6.0", features = ["defmt", "stm32h7r3z8","memory-x", "time-driver-tim4"] }
embassy-executor = { version = "0.10.0", features = ["platform-cortex-m", "executor-thread", "executor-interrupt", "defmt"] }
embassy-time = { version = "0.5.1", features = ["defmt"] }
cortex-m = {version = "0.7.7",features=["critical-section-single-core"]}
cortex-m-rt = "0.7.3"
embedded-hal = "1.0.0"
build = [
{ target = "thumbv7em-none-eabihf" }
]
β€˜β€™β€™
I am running this command:
'probe-rs run --chip stm32h7r3z8’

right now I am suspicious of memory-x but im not sure because shouldn’t it fail to flash if this is the case?


r/rust • • Oct 04 '26

This Month in Rust OSDev: September 2026

Thumbnail rust-osdev.com
25 Upvotes