Today, some big news for River: we’re announcing River Pro for Rust. All the great features of River Pro (workflows, batching, concurrency limits, etc.) implemented from the ground up in Rust.
I first learnt Rust nine years ago, building a podcast backend that never shipped. I was a huge fan of the language and its promise in building safer applications, but the main thing I remember now is how brutally unforgiving it was. Lifetimes, ownership, the borrow checker, String vs str, concurrency model — every aspect was a ball of pain and confusion.
I got in before Tokio and before futures were standardized in core. The proto-futures I was using were packaged in an external crate, and a distinct memory was of the long, near-impossible-to-parse type errors reminiscent of the ones produced by C++ templates. There were instances where I’d spend an hour debugging a couple lines of code:
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> src/engine/mod.rs:77:9
note: ... futures::Then<futures::MapErr<futures::AndThen<futures::MapErr< futures::AndThen<futures::MapErr<futures::AndThen<futures::MapErr< futures::AndThen<futures::MapErr<futures::AndThen<futures::MapErr< futures::AndThen<futures::MapErr<futures::AndThen<futures::MapErr< futures::AndThen<std::boxed::Box<futures::Future< Item=lapin_futures_rustls::lapin::client::Client< lapin_futures_tls_api::AMQPStream>, Error=std::io::Error>>, ...I’d get myself stuck in refactoring traps all the time. I’d realize that I’d started a bad practice somewhere that had been duplicated many times through thousands of lines of code. I wanted to refactor it, but Rust code was so strictly typed that it’d necessitate small changes across hundreds and hundreds of those lines. With no real refactoring tools available beyond regex and real work to finish, I’d give up and leave it as it was. A FIXME of galactic magnitude that hopefully future tooling would help resolve.
The rusty edge
It’ll be a very rare programmer who’s managed to make it to 2026 without being proselytized on Rust to at least some degree, so most of you will be familiar with its better side:
Memory safety: Ownership prevents dangling pointers and use-after-free without a garbage collector.
No garbage collector: Rust has very little runtime overhead. A minimal program I built for my Mac with size optimizations was just 279 KiB, and its entire enter → exit lifecycle took about 1.1 ms in repeated runs (
/usr/bin/truetook 0.8 ms).Safer concurrency: The compiler catches data races between concurrent code so they never become production problems.
Zero-cost abstractions: Iterators and generics keep code expressive without adding runtime overhead.
Once you have a finished Rust program, it’s fast and safe, with tremendous low-memory properties, but it’s a double-edged sword — right up to the moment it’s done, it’s hard to learn, slow to write, and so frustrating to use that legend has it that many a case of premature baldness owes its origin to a self-directed apprenticeship in Rust.
The borrow checker meets its match
And that’s why this year’s been so interesting. In 2026 the perfect Rust programmer emerged. One that doesn’t get lifetimes mixed up, one that knows the borrow checker’s rules better than the man who wrote it, and one that’s more than happy to work on something else while waiting on compile times. That’s right, our old friend Claude/Codex.
The main impediment to Rust’s adoption was a frustrating multi-month learning experience and relatively low development momentum. Those problems have been blasted away so thoroughly that it’s like they never even existed. Another six months and people won’t even remember them.
We’ve seen some incredible developments this year already:
Bun was transcoded from Zig to Rust. After a lot of public consternation and hand wringing, the release went out so smoothly that practically no one even noticed.
A few weeks ago Anthropic rewrote their messages API from Python to Rust. The result: 40-50% reduction in CPU and 10-20% faster time to first token.
One lone developer has taken it upon himself to rebuild the entire Adobe Creative Suite in Rust-based desktop apps.
From the creator of Rails: the next version of Hey will be in Rust instead of Ruby.
River Pro
Today we’re announcing River Pro for Rust. All the great Pro features you’re used to, but in Rust. Just like with our previous polyglot releases, Rust is a full ground-up reimplementation. With the Rust version of River in your stack, there’s no Go dependency. No Go anywhere, in fact.
Rust supports every Pro feature (see docs for full details). It’s available through our private Cargo registry. See the getting started guide that covers registry access and how to raise Pro migrations.
Let’s take a quick tour of some River Pro Rust-isms that it does better than any other language.
Safe concurrent batches
Types like batch processing’s BatchHandler make concurrent access safe by being Send + Sync. Say we have an implementation that tries to count in a shared HashMap based on job status. A BatchHandler containing a map inside RefCell fails to compile:
struct BatchProcessor { // RefCell permits mutation, but isn't safe to share across threads. counts: RefCell<HashMap<String, usize>>,}Though RefCell allows mutation and satisfies Send (i.e. can move to another thread), it doesn’t satisfy Sync, which requires that multiple threads can safely share references to it.
We can correct the problem using a mutex instead:
struct BatchProcessor { counts: Mutex<HashMap<String, usize>>,}And inside work_batch:
// Inside work_batch:{ let mut counts = self.counts.lock().unwrap(); *counts.entry("processed".to_owned()).or_default() += jobs.len();} // Release the lock before awaiting anything.This builder will self-destruct
When building a workflow in Rust, inserting the workflow consumes its builder. It’s not possible to insert the same builder twice or modify it after insertion. Insertions borrow transactions (see tx) mutably, preventing overlapping use of the same transaction during insertions:
let mut workflow = client.new_workflow(WorkflowOpts::default());workflow.add("send_email", email_args)?;
let mut tx = pool.begin().await?;let inserted = workflow.insert().tx(&mut tx).await?;tx.commit().await?;
// workflow.insert().await?;// Compiler error: workflow was moved by the first insert.The reason the builder is consumed is that the workflow’s insert function takes self by value, so the builder’s ownership is transferred into WorkflowInsertRequest, rendering it unavailable to the caller:
pub fn insert(self) -> WorkflowInsertRequest<'static> { WorkflowInsertRequest { builder: self, target: Target::Pool, }}Typed workflow output
An important facility for workflows is output that lets one task pass information to another. Rust + Serde make this terse and pleasant. Define the output format once and use the struct when recording output or on the other side when reading it back out:
#[derive(serde::Serialize, serde::Deserialize)]struct ShippingQuote { cents: i64,}
// In the upstream worker:context.record_output(ShippingQuote { cents: 4200 })?;
// In a downstream worker:let quote = workflow .load_output::<ShippingQuote>("quote_shipping") .await?;
println!("Shipping costs {} cents", quote.cents);Compared to Ruby’s raw JSON or TypeScript’s schemas, Rust’s approach is safer and more ergonomic.
Automatic key cleanup
Rust’s Drop trait is one of the language’s neatest tricks. A bit like a C++ destructor, it runs when a value goes out of scope. For River’s encrypted jobs, SecretKey leverages Drop so it’s wiped as soon as it goes out of scope:
use riverqueue_pro::encrypt::Encryptor;use riverqueue_pro::encrypt::secretbox::{ SecretKey, SecretboxEncryptor,};
{ let key = SecretKey::try_from(key_bytes.as_slice())?; assert_eq!(format!("{key:?}"), "SecretKey(..)");
let encryptor = SecretboxEncryptor::new([key])?; let ciphertext = encryptor.encrypt(b"private job arguments")?;} // The encryptor's owned key storage is wiped here.This happens because SecretKey wraps its bytes in Zeroizing:
use zeroize::Zeroizing;
pub struct SecretKey(Zeroizing<[u8; 32]>);Zeroizing implements Drop as:
impl<Z: Zeroize + ?Sized> Drop for Zeroizing<Z> { fn drop(&mut self) { self.0.zeroize(); }}zeroize() has to be implemented somewhat carefully because an ordinary call like key.fill(0) could be removed by an optimizer when it notices that the program never reads the memory again. zeroize() uses a volatile write that’ll never be optimized out. This code is a little simplified for brevity, but gives you the right idea:
for byte in key.iter_mut() { unsafe { core::ptr::write_volatile(byte, 0) };}Fine-grained compilation control
Rust’s compile speeds aren’t known to be its strongest point. Thankfully, dependency features let callers opt into exactly which aspects of River they need. For example, by only opting into sqlite and workflow we leave out Postgres, batching, and secretbox, saving time and producing a smaller binary:
[dependencies.riverqueue-pro]version = "=0.1.0-alpha.1"registry = "river"default-features = falsefeatures = ["sqlite", "workflow"]The future is FAST
In retrospect, even before the ascendancy of LLMs, it should have told us something when runtimes and tooling for other languages started being rewritten in Rust instead of the language itself (e.g. Ruff, uv, YJIT, ZJIT, Deno, Bun, …). This language’s obviously had legs for a while, and more recently the momentum it’s developed is undeniable.
We should be optimistic about a future where Rust is a mainstay. In a world where we’re experiencing a sudden crunch in chips and memory, our apps and server processes will use less CPU, less memory, and be effortlessly more concurrent. And we’ll get all of this without giving up anything — your LLM’s just as good at writing Rust as it ever was Python. Better even.
Adding Rust doesn’t change our commitment to Go. We have a comfortable routine wherein anytime we add a new feature or fix a bug we do it in Go first, check the implementation, then port it to all other River-supported languages. As incredible as Rust is, we’re still expecting Go’s fast compile times and pragmatic design to be major assets in the LLM age. And not to mention that Rust still has the occasional absurdity that you can’t help but just laugh at.
We’d obviously love for you to jump to River Pro for Rust right away, but even if you don’t, stop by and try our open-source River for Rust. It’s still the best job queue on the market!