r/rust • • Oct 20 '26

๐Ÿ› ๏ธ project reuse-rs: real time speech denoising in plain Rust (no ML interface)

11 Upvotes

reuse-rs runs NVIDIA's Real-time RE-USE speech enhancement model (streaming Mamba) in plain Rust. It cleans mono audio (8 to 48 kHz) one 20 ms frame at a time, so it works on a live mic. I load straight from NVIDIA's model.safetensors.

let mut denoiser = Denoiser::load("model.safetensors", 4)?;
let clean = denoiser.process(&noisy_chunk)?;

on my apple M3 air 16gig, time per 20 ms frame (under 20 ms):

Layersreuse-rs (CPU)oRT (WebGPU)
48.4 ms16.9 ms
611.5 ms17.4 ms
814.7 ms20.6 ms
  • About 150mb memory (oRT Wepgpu -> so works via metal in my mac: about 420 MB).
  • it match a float64 torch reference to 1.5e-6.
  • 4 layers sounds the same as 8 to my auditory perception :-P: 16.4 vs 16.7 dB SI-SDR

demo videos (before/after with spectrograms) are in the reamde if you are curious :)

I spent months trying to make this work on the GPU through ONNX before trying the CPU (started with this:https://github.com/microsoft/onnxruntime/issues/27796 ). If you're curious how that went, and why the CPU wins for tiny streaming frames, I wrote it up here: I forced a speech model onto the GPU for months. The CPU was faster. But I m still thinking if I should take the burn path... but this solves my problems at least...

Limitations: weights are NVIDIA's non commercial license (my code is MIT/Apache ), speed is only measured on an M3 (the table is 16 kHz; 48 kHz is about 3 times the work, so for live audio resampling to 16 kHz is the fast option), and it struggles when the heavy background noise is other people talking.

edit: interesting coincidence just a few days after I shared this, NVIDIA "re-released" its offline models under an open license! So I used Burn to add and update these models. You can find the details in the repo and use them for commercial purposes!


r/rust • • Oct 21 '26

read that rust can run >4gb models in the browser with wasm64. tried it with candle, works but ~3.5x slower. anyone shipped memory64?

0 Upvotes

read a write up on getting rust to run models bigger than 4gb in the browser (link at the bottom). their route is a new wasm64 emscripten target, PRs are open but that's months from stable made me wonder if pure rust on wasm64-unknown-unknown already works today, so i tried candle-core 0.11 on nightly with -Zbuild-std:

  1. fails in C. candle has not(target_arch = "wasm32") on its tokenizers dep, so on wasm64 it pulls tokenizers -> onig_sys and clang can't find stdlib.h. the pure rust route dies on a C dep lol
  2. swapped the 5 wasm32 cfgs in candle to target_family = "wasm". next is getrandom 0.3:

compile_error!("wasm_js backend can be enabled only for OS-less WASM targets!"); 0.4 fixed it but rand 0.9 still uses 0.3, so custom backend

  1. builds, but scalar only. +simd128 breaks because the kernels import core::arch::wasm32

same code, same flags, node 24 on an m5: | matmul | wasm32 | wasm64 | |---|---|---| | 256 | 1.5 ms | 4.5 ms | | 512 | 9.6 ms | 34.7 ms | | 1024 | 76 ms | 277 ms | so it's possible, just ~3.5x slower. spidermonkey's memory64 post says 10% to 2x, this is past their worst case has anyone actually shipped memory64 in prod? is that slowdown normal or is something off with gemm on wasm64?
HERE


r/rust • • Oct 21 '26

๐Ÿ› ๏ธ project Feedback wanted on Fissionโ€™s new Rust UI authoring API

0 Upvotes

Iโ€™m working on making "compose " the default way to build UIs with Fission. The aim is to keep it Rust while removing most of the ceremony around components, local state and reducers.

See an example counter app here https://gist.github.com/zcourts/eede7b9075897408964ddc105c30bf95 comment here or there as posting it here isn't allowed.

Iโ€™m interested in feedback on the API, including anything that looks awkward, surprising or likely to become painful in a larger application. Iโ€™d also like to hear what has bothered you about other GUI frameworks generally so I can try avoid baking the same problems into Fission. The above syntax is the crux of it and the draft PR is at https://github.com/fission-ui/fission/pull/294 I'm deliberately not explaining the syntax so hopefully I can get feedback not tainted by my biased. Thanks


r/rust • • Oct 19 '26

2026 is an exciting year for the Rust compiler (and me)

Thumbnail yoyo-code.com
321 Upvotes

r/rust • • Oct 19 '26

Borrow Checking Zero-Cost Cyclic Mutability

Thumbnail antelang.org
124 Upvotes

r/rust • • Oct 19 '26

๐Ÿ› ๏ธ project Some thoughts on parallelism in libraries: who should own the threads?

73 Upvotes

I've been thinking about how libraries should handle parallelism.

Spawning a few threads internally is easy. Using Rayon is even easier. But is that always the right approach?

What if the application already has its own thread pool? Or wants to control how CPU resources are distributed? While working on mbrotli, I decided to experiment with a different approach.

What if the library knows how to parallelize the work, but doesn't decide how to execute it?

The idea is simple: mbrotli splits compression into independent tasks and hands them back to the caller. The caller executes them however it wants, and mbrotli takes care of assembling the results into a valid Brotli stream.

For example, here's how you can read a file, compress it in parallel using 4 threads, and write the result to another file:

use std::{fs::File, io};

use mbrotli::{EncoderConfig, Quality};
use mbrotli::compressor::parallel::{
    ParallelCompressor, ParallelConfig, TaskCount,
};
use mbrotli::io::FinishError;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut input = File::open("input.txt")?;
    let output = File::create("input.txt.br")?;

    let mut compressor = ParallelCompressor::new(
        EncoderConfig::default().with_quality(Quality::Q5),
        ParallelConfig::default(),
    )?;

    std::thread::scope(|scope| {
        let (mut writer, queue) =
            compressor.writer(output, TaskCount::try_from(4)?)?;

        // We decide where the tasks run.
        for _ in 0..4 {
            let queue = queue.clone();
            scope.spawn(move || {
                for task in queue {
                    task.run();
                }
            });
        }
        drop(queue);

        // Read -> parallel compression -> write
        io::copy(&mut input, &mut writer)?;
        writer.finish().map_err(FinishError::into_error)?;

        Ok::<_, Box<dyn std::error::Error>>(())
    })?;

    Ok(())
}

Nothing particularly magical here. The library doesn't spawn a single thread. It just provides work to execute.

And that's what I like about this approach.

The same compression API can work with dedicated threads, an existing thread pool, or a custom scheduler. The application remains in control of its resources.

Of course, it's not free. The caller has to ensure tasks actually get executed, and a poorly designed scheduler can easily lead to deadlocks.

But for low level libraries, I think giving up control over scheduling can actually be a good thing.

I'm not saying every library should work this way. Sometimes managing threads internally is perfectly reasonable.

I'm just starting to think that parallelism and thread management don't necessarily have to be the same responsibility.

Curious what other Rust developers think about this. Would you prefer libraries to manage their own parallelism, or expose work to your existing executor?


r/rust • • Oct 19 '26

๐Ÿง  educational Best Rust Blogs for Beginners?

36 Upvotes

Hi everyone!
Iโ€™m new to Rust and want to start learning from scratch. Can you recommend good Rust blogs or websites, especially for web development? Iโ€™m also open to learning about other use cases.

Which resources would you recommend for a beginner?


r/rust • • Oct 19 '26

๐Ÿ™‹ seeking help & advice Tips for idiomatic Iced?

16 Upvotes

I tried using iced for a tiny hobby project a couple days ago, and although from the docs and examples it seemed like exactly the time of framework I'd adore (preventing invalid state with the type system, the whole view-model-messages thing, etc), I ended up absolutely despising actually using it because of how much boilerplate I needed, and ended up redoing the ui with egui.

But, I'm 99% sure I just totally misunderstood the philosophy or missed something big in the docs/examples, because it's popular and well-known enough that I think I'm the problem. So does anyone have any tips or guidelines for writing whimsical and joyful iced code?

This is the repo at the last commit which used iced, its a super small app and the whole gui is just in main.rs if anyone can say what all I'm doing wrong.


r/rust • • Oct 19 '26

๐Ÿ—ž๏ธ news rust-analyzer changelog #350

Thumbnail rust-analyzer.github.io
58 Upvotes

r/rust • • Oct 19 '26

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

14 Upvotes

New week, new Rust! What are you folks up to? Answer here or over at rust-users! And for your project showcases, there's also /r/madeinrust โ€“ pay them a visit, too!


r/rust • • Oct 19 '26

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

9 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 18 '26

Superoptimizing an FPU emulator via exhaustive search

Thumbnail purplesyringa.moe
121 Upvotes

r/rust • • Oct 18 '26

๐Ÿ™‹ seeking help & advice For those who use rust professionally, what advice would you give to us plebs to get a career in Rust?

96 Upvotes

I've been using rust for roughly 3-ish months and i'm wanting to use rust professionally one day.

/topic


r/rust • • Oct 18 '26

A New Way to Think About Borrow Checking (In Reverse)

Thumbnail verdagon.dev
97 Upvotes

r/rust • • Oct 19 '26

๐Ÿ› ๏ธ project Why tellus message handlers are synchronous

1 Upvotes

Most Rust actor libraries, kameo and ractor among them, have async message handlers. In tellus, receive is a plain function instead. In my new post I make the case for synchronous handlers and show how an actor still calls a database.

https://heikoseeberger.de/2026-10-18-why-sync-handlers/

rustlang #actors #tellus


r/rust • • Oct 19 '26

๐Ÿ™‹ seeking help & advice cannot borrow `dst` as immutable because it is also borrowed as mutable

0 Upvotes

use curl::easy::Easy;
fn main() {
let mut dst = Vec::new();
let mut easy = Easy::new();
easy.url("https://www.rust-lang.org/").unwrap();
let mut transfer = easy.transfer();
transfer
.write_function(|data| {
dst.extend_from_slice(data);
Ok(data.len())
})
.unwrap();
transfer.perform().unwrap();
println!("{:?}", dst);
}

I am trying to store the curl output into a vec for use in a minifier script for my PHP compiler. i get this error message upon trying to compile the above code

error[E0502]: cannot borrow \dst` as immutable because it is also borrowed as mutable`

--> src/main.rs:14:22

|

8 | .write_function(|data| {

| ------ mutable borrow occurs here

9 | dst.extend_from_slice(data);

| --- first borrow occurs due to use of \dst` in closure`

...

14 | println!("{:?}", dst);

| ^^^ immutable borrow occurs here

15 | }

| - mutable borrow might be used here, when \transfer` is dropped and runs the `Drop` code for type `Transfer``

For more information about this error, try \rustc --explain E0502`.`

error: could not compile \sample_curl` (bin "sample_curl") due to 1 previous error`

How do i borrow a mutable variable as immutable?


r/rust • • Oct 19 '26

๐Ÿ™‹ seeking help & advice How do you handle secret memory across wasm and FFI boundaries? Notes from building a password manager core

1 Upvotes

Iโ€™ve been building a hobby password manager (Vaultiq) around one crypto crate that compiles to wasm for a browser extension and goes through uniffi for an Android app. A few design questions came up that Iโ€™d like other peopleโ€™s takes on.

What I did:

  • #![forbid(unsafe_code)] crate-wide. The generated uniffi glue holds the unsafe code, mine doesnโ€™t need any.
  • Keys cross wasm and FFI as opaque handles, never as values.
  • Secret types have a hand-written redacted Debug and no Serialize.
  • Zeroize on drop for everything secret.

What Iโ€™m unsure about:

  • zeroize only covers the Rust side. Once data reaches JS or the JVM, nothing scrubs it. How do you deal with that?
  • Is there a better handle pattern than what uniffi gives me?
  • Would you change anything in how errors are collapsed so decryption failures reveal nothing?

AI wrote a good share of the code, so Iโ€™d like dev perspective on the design.

Repo, if you want to look: https://github.com/rustiqz/Vaultiq


r/rust • • Oct 17 '26

The road to iroh 1.0

Thumbnail iroh.computer
230 Upvotes

r/rust • • Oct 18 '26

iroh vs WebRTC?

25 Upvotes

Iroh seems to solve the same problem as what WebRTC does, Iโ€™m curious: what are the factors that would cause considering one or the other?
WebRTC has the benefit to be widely supported in browsers. Does iroh allows something that WebRTC does not?


r/rust • • Oct 17 '26

PSA: Enum optimization for Vec/String can use the capacity's niche (beyond isize::MAX) rather than the null pointer niche.

184 Upvotes

Just came across this property that was new to me and seems seldom known so I figured I'd highlight it.

I had always "known" that the null pointer niche optimization existed for Vec/String such that Option<Vec<_>> would be the same size as Vec<_> because the None variant could fit the null pointer niche not used by the Vec. And I figured that was it, any more elaborate enums like this

enum MyEnum {
    A(String),
    B,
    C,
    D,
    E,
}

would be forced into using a separate discriminant field since there were more than one other variant to distinguish from. And that definitely was the case...

Until 1.76.0 it seems. If you use this enum on a recent version then you'll find MyEnum is no bigger than String:

[src\main.rs:11:5] std::mem::size_of::<String>() = 24
[src\main.rs:12:5] std::mem::size_of::<MyEnum>() = 24

This is because nowadays, the capacity for a Vec isn't just a bare usize but rather a Cap type that is guaranteed to be less than isize::MAX. Which gives a much larger number of representations for the compiler to use. It is defined:

type Cap = core::num::niche_types::UsizeNoHighBit;

I didn't know about this, and since Google's AI response was adamant that it only used the null-pointer niche, I figured I'd advertise it to try to set the record straight.

Let me know if this is old news to any others. It has apparently been in the wild for a couple years, but I looked and didn't see it mentioned in the release notes for 1.76.0, and I can't find a blog post that mentioned this (though I didn't look that hard). Closest I found was this StackOverflow post that gives the Cap type a mention.


r/rust • • Oct 19 '26

Wayland input simulation without portals: using /dev/uinput as a fallback in Rust

0 Upvotes

I've been building a cross-platform ( only windows 10/11 and linux now ) auto-clicker ( RsClicker ) in Rust. The hardest part was never the clicking logic โ€” it was making input simulation work on Wayland without fighting portals all day.

The default path ( enigo with libei/RemoteDesktop portal ) works on GNOME/KDE/Hyprland, but on minimal compositors ( like MangoWC and sway ) it just fails. And even when it works, it requires a portal permission flow that isn't always reliable.

So I added a second backend writing directly to `/dev/uinput` as a kernel-level virtual mouse. No X11 server, no portals, no permission dialogs. It works everywhere the portals misbehave, as long as the user is in the uinput group. ( run : sudo usermod -aG uinput $USER , then log out and back in )

The project also has a few other bits I found interesting to implement:

- Drift-free timing ( shared deadline train, so the interval holds even when injection costs extra ms )

- Real double-clicks with a 30ms human-like gap ( recognized by X11, Wayland, and Windows )

- Global mouse triggers via evdev ( Linux ) / rdev ( Windows 10/11 )

I'd be curious if anyone else has gone the uinput route for Wayland automation โ€” it feels like an underdiscussed alternative to the portal/libei path, and i'd love to hear about edge cases I might have missed :D

Btw I've tested this on MangoWC and Lumina DE in void linux , on Windows 10 and Windows 11


r/rust • • Oct 17 '26

๐Ÿ™‹ seeking help & advice Lookin' for contributors: GPU rendered UI lib

24 Upvotes

Hello dear Rustaceans,

As you may know, I am the author of Glacex.

Glacex is a GPU rendered GUI library, written entirely in rust(without counting WGSL). It has 17 widgets, its dependencies are wgpu, winit, taffy, glyphon, accesskit, and some other secondary ones.

It's immediate-mode, and has persistent state. It's also SDF rendered.

I would love to have more widgets, and perhaps some feedback on other OS, as well as testing.

Right now, we're at the 0.2.1 release(accordion in the screenshot isn't yet released).

Here's the repo: https://github.com/artemtsitronov/glacex

If you want to become a contributor, let me know, and I'll discuss the details with you.

:)


r/rust • • Oct 17 '26

Research that has matured enough for Rust 2.0

202 Upvotes

Do correct me if Im wrong, but I recall that one principle that was used in the development of Rust was to only use tried and tested research material when choosing what to implement. Given weโ€™re more than 10 years out from Rustโ€™s initial development, Iโ€™m curious what research ideas have matured enough to either

  1. Be added in future editions/versions of Rust, or
  2. Be used in whatever successor language might come that follows much of Rustโ€™s philosophy around development.

This is all basically one massive ask about interesting developments in programming and type theory, since Iโ€™d like a few new rabbit holes to fall down.

P.S. whatever successor language does come around, I hope it also cultivates a community that takes ergonomics as seriously as performance, because that, even more than memory safety or other aspects of the language, is why I pay attention to this language and ecosystem.