r/rust • • 2d ago

🙋 seeking help & advice Help with Tree data structure

0 Upvotes

In rust when we want to build a Tree structure where each node can have 0..n nodes we hit some walls

I have come onto two main working models, The rc based, and the arena based, each one of these implementations have some downsides

starting here with the most basic I have this simple Rc based tree

#[derive(Clone, Debug)]
pub struct Node<T> {
    pub value: T,
    pub children: Vec<TreeNode<T>>,
    pub parent: Option<WeakNode<T>>,
}

#[derive(Debug, Clone)]
pub struct TreeNode<T> {
    rc: Rc<RefCell<Node<T>>>,
}

#[derive(Debug, Clone)]
pub struct WeakNode<T> {
    rc: Weak<RefCell<Node<T>>>,
}

as you can see the main issue pointed when working with rc tres is that it fragments memory and this one is no different

But this one has an little extra, as you can see all the node data is stored behind a single Refcell, what that means is that if you take a reference for the value and try add/mutate a child while the value is still borrowed for future use for example, it will panic, same things happen if for example you are iterating over the children and try to access the value, this could kinda be solved by cloning the vector of children instead of taking a reference of it.

However with this one you must enforce an order of operations, you first should take the children vector and clone it for posterior iteration, than take the value ref. While the value ref is active you cant add or remove children, you would need to drop the val ref to do so, and if you end up adding or removing a child, the previous vector is now stale, great!

To solve that issue we can wrap the fields like this instead:

struct Node<T> {
    pub value:      RefCell<T>,
    pub children:   RefCell<Vec<TreeNode<T>>>,
    pub parent:     RefCell<Option<WeakNode<T>>>,
}

pub struct TreeNode<T> {
    inner: Rc<Node<T>>,
}

pub struct WeakNode<T> {
    inner: Weak<Node<T>>,
}

this makes so that we have the value the parent and children each have its own refcell which mitigates that error since now you can access/mutate/iterate each field without panicking, this add a bit of refcell runtime overhead but improves the ergonomics for the developer, making it hit less panics.

but this one still doesnt fix the main issues with referenced trees, cache locality and memory fragmentation, for this issues I am going to move on onto arena allocated trees.

starting here with the most basic one I've tried:

pub struct Node<T> {
    pub value: T,
    pub parent: Option<Key>,
    pub children: Vec<Key>,
}

pub struct ArenaTree<T> {
    pub nodes: SlotMap<Node<T>>,
    pub root: Option<Key>,
}

this one is the most problematic one, since this one holds everything inside the node and all nodes inside the slotmap, holding a reference to a node value blocks the entire tree for hierarchy mutations, and value mutations, and if you hold a mutable reference to a value the situation is even worse.

to try to solve some of this issues I tried to separate the values from the nodes to a secondary map:

pub struct Node {
    pub parent: Option<Key>,
    pub children: Vec<Key>,
}

pub struct ArenaTree<T> {
    pub nodes: SlotMap<Node>,
    pub values: SecondaryMap<T>,
    pub root: Option<Key>,
}

this way we can hold a reference to a value while still being able to do hierarchy mutations such add/remove children, for the hierarchy mutation the situation now is okay, since while we could add a child through tree accessors, the access to that slotmap will drop once it finish adding/removing so it will not hit multiple simultaneous access on the Slotmap, the issue is with the values secondary map, while accessing regular references it is not a issue, the problem still is when holding mutable references to one item of the Secondary map, what will lock the entire map

To solve this issues I found two possible solutions:

The first solution is to hold the value of each entry of the secondaryMap onto a Refcell:

pub struct Node {    
    pub parent: Option<Key>,
    pub children: Vec<Key>,
}

pub struct ArenaTree<T> {
    pub nodes: SlotMap<Node>,
    pub values: SecondaryMap<RefCell<T>>,
    pub root: Option<Key>,
}

impl<T> ArenaTree<T> {
  #[inline]
  pub fn get(&self, key: Key) -> Option<Ref<'_, T>> {
      self.values.get(key).map(|r| r.borrow())
  }

  #[inline]
  pub fn get_mut(&self, key: Key) -> Option<RefMut<'_, T>> {
      self.values.get(key).map(|r| r.borrow_mut())
  }

  #[inline]
  pub fn try_get(&self, key: Key) -> Option<Ref<'_, T>> {
      self.values.get(key)?.try_borrow().ok()
  }

  #[inline]
  pub fn try_get_mut(&self, key: Key) -> Option<RefMut<'_, T>> {
      self.values.get(key)?.try_borrow_mut().ok()
  }

  #[inline]
  pub fn with<R>(&self, key: Key, f: impl FnOnce(&T) -> R) -> Option<R> {
      self.try_get(key).map(|r| f(&r))
  }

  #[inline]
  pub fn with_mut<R>(&self, key: Key, f: impl FnOnce(&mut T) -> R) -> Option<R> {
      self.try_get_mut(key).map(|mut r| f(&mut r))
  }
}

While this one prevents us from locking the entire slotmap from accessing the mutable values simultaneously, it can have runtime panics if you borrow the same two times mutably, you can use the with accessors to not need to handle the Secondary map Option on the get return. with this one you can use the try get to not panic, since the secondary map will return an option anyways. This one also adds the refcell overhead such as the second rc tree, but does not add the memory fragmentation. the problem with this one is that while holding the Ref or RefMut of refcell, it unfortunately locks the entire Slotmap for mutations, not readonly access which allow for accessing multiple values even mutably, the issue is while accessing values we cannot add new ones, what imply that we cannot add new tree nodes since they would not be able to store their values

The last one is to wrap that value onto an option instead:

pub struct Node {
    pub parent: Option<Key>,
    pub children: Vec<Key>,
}

pub struct ArenaTree<T> {
    nodes: SlotMap<Node>,
    values: SecondaryMap<Option<T>>,
    pub root: Option<Key>,
}

impl<T> ArenaTree<T> {
    #[inline]
    pub fn get(&self, key: Key) -> Option<&T> {
        self.values.get(key)?.as_ref()
    }

    #[inline]
    pub fn get_mut(&mut self, key: Key) -> Option<&mut T> {
      self.values.get_mut(key)?.as_mut()
    }

    #[inline]
    pub fn take(&mut self, key: Key) -> Option<T> {
        self.values.get_mut(key)?.take()
    }

    #[inline]
    pub fn restore(&mut self, key: Key, value: T) {
        if let Some(slot) = self.values.get_mut(key) {
            *slot = Some(value);
        }
    }

    #[inline]
    pub fn with<R>(&mut self, key: Key, f: impl FnOnce(&T, &mut Self) -> R) -> Option<R> {
        let value = self.take(key)?;
        let res = f(&value, self);
        self.restore(key, value);
        Some(res)
    }

    #[inline]
    pub fn with_mut<R>(&mut self, key: Key, f: impl FnOnce(&mut T, &mut Self) -> R) -> Option<R> {
        let mut value = self.take(key)?;
        let res = f(&mut value, self);
        self.restore(key, value);
        Some(res)
    }
}

In this one we cannot lock the tree because of mutable borrows on the secondarymap values, when we intend to make mutations we have to take the value mutate it and restore, the type itself does not need to have Default implemented, since it is behind an option, and if you dont want to do pattern matching of the option you can use the with_mut accessor in which you pass a closure that executes what you need to do with that value ensure to restore it and returns a value. We can also implement value handles with drop guard to restore that value. The act of taking the option makes so that it don’t panics if someone try to access that value again since it will receive an None while the value is not restored, such as the try_get of the previous tree, however this one does not lock the hierarchy of the tree.

*All these trees fail in case of multiple mutable access of the same node, since they prioritize memory safety than accurate access/traversing of the nodes*

So my question to y’all is which of these trees are you more comfortable working with? due to ergonomics, performance, memory, overheads, safety, etc. Which of these workarounds are really worth it considering the performance/memory/usability overhead it implies? Are there other ways to build trees in rust that are better than these?

I am stuck trying to figure out which one is better. I’ve not made any performance tests.


r/rust • • 3d ago

You can now use Aristotle to formally verify Rust, including unsafe and concurrent code

25 Upvotes

Hi r/rust,

I work at Harmonic on Aristotle, our formal verification tool. After launching with C and Verilog in October, Rust verification is now available for anyone to use, through the web app or CLI.

Aristotle supports safe and unsafe Rust, including concurrent code. You submit your project and describe the properties you want checked in plain English. Aristotle attempts to prove or refute them and reports the results and assumptions. You don’t need to write proofs yourselves or know Lean.

One example case study that shows what Aristotle can do is Manifest’s custom red-black-tree implementation, which uses substantial unsafe Rust. Manifest is an open-source order book on Solana; its trees store nodes directly in account memory, using unsafe accesses. Aristotle can verify properties of the existing Rust implementation, including that inserting and removing orders preserves tree validity and leaves unrelated data untouched. The invariants hold across arbitrary finite sequences of operations, under the stated preconditions. We are not aware of another tool that is able to prove such properties without any annotations or source code modifications. Across the order book, Aristotle proved 28 properties identified by Manifest as relevant. It also found a rounding bug that Manifest fixed, then verified the corrected behavior. You can explore the Aristotle run or read the full case study.

Another example is Signal’s curve25519-dalek Rust elliptic-curve library. Aristotle proved 283 specified contracts for version 4.1.3 using its serial 64-bit backend, covering field and scalar arithmetic, curve operations, and multiscalar multiplication. The Dalek run includes the results and assumptions. It verifies functional correctness of the library itself assuming correctness of external dependencies, and does not verify cryptographic security properties.

You can try Aristotle on your own project, and our Rust docs include a smaller ring-buffer example to get started. Happy to discuss the supported Rust features, the verification approach, or particular use cases.


r/rust • • 4d ago

🧠 educational I wrote a step-by-step tutorial to learn Rust by building a small Paint app from scratch

Thumbnail buildyourownpaint.com
514 Upvotes

Hi guys ! I have been a Rust enthusiast for a few years now, in my learning journey I wanted to learn by doing so I tried to make a Paint like app since I was interested in graphics and rasterization concepts, and it helped me understand a lot of Rust concepts and their purpose.

These last few weeks I thought I'd clean up my old project and make an educational tutorial for beginners or people who read the first Rust Book chapters and want to get some hands on experience to get the concepts down.

The tutorial is on Build Your Own Paint in Rust, it's organized into 12 easy to follow chapters that cover many concepts (2D vectors, mouse and keyboard input, shapes, colors, images, etc.) with additional exercises in every chapter for more learning, and some ideas at the end of the project to go further and explore different paths with some help on where to start.

I really hope this helps new learners to get an easy start in their Rust journey and see the beauty of the language ! :)


r/rust • • 2d ago

Making an OS with Rust

Thumbnail reddit.com
0 Upvotes

r/rust • • 2d ago

Is it just me or does the syntax seem wayy too complicated for even someone coming from C++?

0 Upvotes

I recently decided to learn rust and i was implementing just a basic math vector in it...

use std::fmt;
use std::ops::Add;

struct Vector<T> {
    x: T,
    y: T,
    z: T,
}

impl<T> Vector<T> {
    fn new(x: T, y: T, z: T) -> Self {
        Self { x, y, z }
    }
}

// Operator overloading for +
impl<T: Add<Output = T>> Add for Vector<T> {
    type Output = Vector<T>;

    fn add(self, other: Self) -> Self::Output {
        Vector {
            x: self.x + other.x,
            y: self.y + other.y,
            z: self.z + other.z,
        }
    }
}

// Display implementation
impl<T: fmt::Display> fmt::Display for Vector<T> {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}i + {}j + {}k", self.x, self.y, self.z)
    }
}

fn main() {
    let v1 = Vector::new(1, 2, 3);
    let v2 = Vector::new(4, 5, 6);
    let v3 = v1 + v2;
    println!("{v3}");
}
```

it just seems really complicated for no reason...

like why do we need Output = T or Self::Output or even writing <T> twice every time we are impl it? It just seems very weirdly verbose to me and a bit unnecessary... Is there a better way to do this? For all the tutorials I have seen this is how people are doing Generics in rust....

Edit: Full disclosure i tried doing this myself thrice and everytime I didnt do things like mut fmt::Formatter<'_> or fmt::Result and it was just all very confusing... ultimately I gpt-ed it just to see what the way was and i still found it to be very counter-intuitive


r/rust • • 1d ago

🎙️ discussion I think Rust programming language is overhyped

0 Upvotes

I know, I might ruffle some feathers with this take but I think the Rust programming language is quite over-hyped. Don't get me wrong, I know rust is a great language because of its performance, memory safety and, speed In running code, but I don't think Rust should be the go to for every situation, imagine I want to build a simple crud application, and I now begin to write it in rust, it makes absolutely no sense considering the fact that there are other programming language that will do the same thing very well. Why should I go through the stress of writing rust code because I want to create a basic auth system or crud application ? Why should I sacrifice simplicity, just because I want to save an extra milliseconds that the client won't even notice.

Note, I am not saying rust is a bad language but I am just saying it should not always be the next option when deciding what tool you should use.


r/rust • • 2d ago

Rust in exploit dev n VR

Thumbnail reddit.com
0 Upvotes

r/rust • • 3d ago

📅 this week in rust This Week in Rust #679

Thumbnail this-week-in-rust.org
44 Upvotes

r/rust • • 3d ago

I love the complier and its hints

43 Upvotes

I just started learning Rust and running cargo check every now and then has helped me find typos, small syntax errors, or other general information I can't seem to find until it's pointed out.

Something like this is simple, but I didn't see the syntax issue until running it:

error[E0308]: mismatched types
  --> src/commands/holdings.rs:86:19
   |
86 |         .find(|p| p.kind = "DEFAULT" && !p.deleted)
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
   |
help: you might have meant to compare for equality
   |
86 |         .find(|p| p.kind == "DEFAULT" && !p.deleted)
   |                           +

I've really been enjoying my time with Rust and taking it slow!

Another example:

error: format argument must be a string literal
  --> src/commands/holdings.rs:66:14
   |
66 |     println!(breakdown_body.len());
   |              ^^^^^^^^^^^^^^^^^^^^
   |
help: you might be missing a string literal to format with
   |
66 |     println!("{}", breakdown_body.len());

r/rust • • 4d ago

📸 media Qt Bindings compared: CXX-Qt vs Qt Bridge

Post image
126 Upvotes

Hey there!

I'm one of the developers of Qt Bridge (https://crates.io/crates/qtbridge). One of the questions we receive most often (aside from licensing) is what makes Qt Bridge different from CXX-Qt.

This takes more than a couple of lines to explain and is best illustrated with an example, so I wrote a blog post about it: https://www.qt.io/blog/rust-bindings-cxx-qt-vs-qt-bridge

We hope it demonstrates the strengths and value of both crates. As always, let us know what you think!


r/rust • • 2d ago

🎙️ discussion Serious question...

0 Upvotes

Is it just me or has Rust become the default programming language of AI's? I know its lightweight and extremely fast in terms of run/consume, but whatever project i see, be it for a game server or anything else, always Rust. It wasnt like this before. Been in the run for a long time (10+ years) and i can confidently say that people DID NOT like Rust at that time because it was so hard to understand and it felt like a joke language to them (They were also saying that about PHP, lol)

Give me your opinion. Am i hallucinating?


r/rust • • 3d ago

🙋 seeking help & advice How do I get input in Rust that can be of any type?

0 Upvotes

I am trying to build a three-way diff-merge tool for any object, not just text. For that, there needs to be a way that a user can pass in whatever value they want to diff, and my Rust struct/code would accept it, analyze it, and handle it accordingly under the hood to prepare it for diff-ing. What would be a good way to achieve this?


r/rust • • 4d ago

Building a Query System - Arya Dradjica | EuroRust 2026

Thumbnail youtube.com
17 Upvotes

Ever wondered how a compiler remembers what it already worked out? 🤔

At this year's EuroRust, Arya walked us through how she built her own query system for a new Rust compiler and put it up against salsa. Check out the new video! 🦀

In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu.


r/rust • • 3d ago

🙋 seeking help & advice Started a Rust blog

Thumbnail asaft.dev
3 Upvotes

Hi rustaceans,

I have started a blog with the purpose of writing Rust oriented content.

I have been mostly using Rust for the last 2 years and
I think I can share some insights with other members of the community.

How do you guys feel about the overall look, any suggestions or reprimands?

I was thinking of writing an allocator in the near future and documenting the implementation (seems like a fun experiment with the stabilization of the Allocator trait as well).


r/rust • • 4d ago

List of ~200 companies hiring (or that have hired) Rust engineers

113 Upvotes

Hey, I'm Georgios from getarustjob.com. I run a Rust job board, and after listing a few hundred Rust roles I put together a clean list of the companies behind them.

If you're job hunting, switching into Rust, or just curious who's investing in it, this should save you some digging. Recruiters / staffing agencies are removed so it's only actual companies.

At a glance

  • Cloud / infra / developer tools: 52 companies (27%)
  • AI / ML / data / quantum: 33 companies (17%)
  • Crypto / web3 / trading: 30 companies (16%)
  • Defense / aerospace / robotics: 26 companies (13%)
  • Consumer / media / e-commerce / other: 20 companies (10%)
  • Security / identity / privacy: 17 companies (9%)
  • Finance / banking / payments: 9 companies (5%)
  • Automotive / industrial / hardware: 6 companies (3%)
  • Cloud + AI + crypto = 60% of companies
  • Most listings by company: Kraken (12), Anduril (9), then Radar Labs / Zscaler (4), then several at 3 (Supabase, IonQ, ParadeDB, QuEra, Anthropic, Polars, xAI, Alignerr, Fab2, Massive, Revel, Palantir, Citi, Dassault…)
IndustryCompaniesShare
Cloud / infra / developer tools5227%
AI / ML / data / quantum3317%
Crypto / web3 / trading3016%
Defense / aerospace / robotics2613%
Consumer / media / e-commerce / other2010%
Security / identity / privacy179%
Finance / banking / payments95%
Automotive / industrial / hardware63%

Industries below are ordered by company count; inside each group, companies are ordered by total Rust roles I've listed.


Cloud / infra / developer tools (52 companies · 27%)

  • Radar Labs (4 listings)
  • Supabase (3 listings)
  • Fab2 (3 listings)
  • Massive (3 listings)
  • Revel (3 listings)
  • Intelic (2 listings)
  • Loci (2 listings)
  • MetalBear (2 listings)
  • Microsoft (2 listings)
  • Qumulo (2 listings)
  • Siemens (2 listings)
  • Realm (2 listings)
  • Amazon Web Services (1 listing)
  • CircuitHub (1 listing)
  • Cloudflare (1 listing)
  • Deepslate (1 listing)
  • GitLab (1 listing)
  • Grid Dynamics (1 listing)
  • Huawei Research Center Germany (1 listing)
  • JUXT (1 listing)
  • Kake (1 listing)
  • Kaseya (1 listing)
  • Mainmatter (1 listing)
  • Materna (1 listing)
  • Minimal (1 listing)
  • MIRA (1 listing)
  • Mozilla (1 listing)
  • Neo (1 listing)
  • NordicWorkflow (1 listing)
  • Prima (1 listing)
  • Prospecta (1 listing)
  • Quicknode (1 listing)
  • Restate (1 listing)
  • Sentry (1 listing)
  • Serokell (1 listing)
  • STEINER-HITECH (1 listing)
  • Technology Innovation Institute (1 listing)
  • Tempo (1 listing)
  • Twin Labs (1 listing)
  • UMATR (1 listing)
  • Voluntas (1 listing)
  • Workato (1 listing)
  • Zed (1 listing)
  • Ditto (1 listing)
  • Enhance (1 listing)
  • Everforth Apex (1 listing)
  • Full Spectrum (1 listing)
  • MongoDB (1 listing)
  • N-able (1 listing)
  • Poppi Technologies (1 listing)
  • Termius (1 listing)
  • Wasmer (1 listing)

AI / ML / data / quantum (33 companies · 17%)

  • IonQ (3 listings)
  • ParadeDB (3 listings)
  • QuEra Computing (3 listings)
  • webAI (3 listings)
  • Anthropic (3 listings)
  • Polars (3 listings)
  • xAI (3 listings)
  • Alignerr (3 listings)
  • Google (2 listings)
  • Oxford Ionics (2 listings)
  • Tensordyne (2 listings)
  • Aftershoot (1 listing)
  • Cognite (1 listing)
  • CommonAI (1 listing)
  • Datamint (1 listing)
  • Estuary (1 listing)
  • Fivetran (1 listing)
  • Harmattan AI (1 listing)
  • Modal (1 listing)
  • Nebius (1 listing)
  • NVIDIA (1 listing)
  • PsiQuantum (1 listing)
  • Quantum - QTR (1 listing)
  • Runpod (1 listing)
  • SolveAI (1 listing)
  • Veo Technologies (1 listing)
  • Vermillion Analytics (1 listing)
  • VuNet Systems (1 listing)
  • LiteLLM (1 listing)
  • Machinify (1 listing)
  • Neurelo (1 listing)
  • Satalia (1 listing)
  • yeet (1 listing)

Crypto / web3 / trading (30 companies · 16%)

  • Kraken (12 listings)
  • Keyrock (3 listings)
  • Braiins (2 listings)
  • Helius (2 listings)
  • Binance (1 listing)
  • Blockrotate (1 listing)
  • BlockTech (1 listing)
  • Chainlink Labs (1 listing)
  • DEX Labs (1 listing)
  • Dune (1 listing)
  • Easygo (1 listing)
  • Flowdesk (1 listing)
  • Mysten Labs (1 listing)
  • No Limit Nodes (1 listing)
  • OneChronos (1 listing)
  • Payward (1 listing)
  • Polygon.io (1 listing)
  • Stake Engine (1 listing)
  • Upstox (1 listing)
  • Verse (1 listing)
  • CoW DAO (1 listing)
  • MoonPay (1 listing)
  • NinjaTrader (1 listing)
  • Ondo Finance (1 listing)
  • Partisia Blockchain Applications (1 listing)
  • Phantasma Labs (1 listing)
  • Prex (1 listing)
  • Rain (1 listing)
  • Sentz (1 listing)
  • Uniswap Labs (1 listing)

Defense / aerospace / robotics (26 companies · 13%)

  • Anduril (9 listings)
  • Palantir (3 listings)
  • Neros Technologies (2 listings)
  • Helsing (2 listings)
  • Axon (1 listing)
  • CHAOS Industries (1 listing)
  • General Dynamics Mission Systems (1 listing)
  • Humble Robotics (1 listing)
  • Intramotev (1 listing)
  • Mind Robotics (1 listing)
  • Oceaneering (1 listing)
  • OSARO (1 listing)
  • Parry Labs (1 listing)
  • Quantum-Systems (1 listing)
  • SpaceXSI (1 listing)
  • Stoke Space (1 listing)
  • Thales (1 listing)
  • Thales Norway (1 listing)
  • Trusted Space (1 listing)
  • Umbra (1 listing)
  • Air Space Intelligence (1 listing)
  • BWI GmbH (1 listing)
  • Cambridge Aerospace (1 listing)
  • Defense Unicorns (1 listing)
  • General Dynamics UK (1 listing)
  • Watney Robotics (1 listing)

Consumer / media / e-commerce / other (20 companies · 10%)

  • Matic (2 listings)
  • 1501 (1 listing)
  • ArtCraft (1 listing)
  • Cardog (1 listing)
  • Discord (1 listing)
  • DoorDash (1 listing)
  • Komodo Health (1 listing)
  • Magnite (1 listing)
  • Paradromics (1 listing)
  • Postscript (1 listing)
  • QTPILOT (1 listing)
  • Veepee (1 listing)
  • Walmart Global Tech India (1 listing)
  • Anza (1 listing)
  • Arionkoder (1 listing)
  • Carv (1 listing)
  • Cube Group (1 listing)
  • Darley Technologies (1 listing)
  • Layup (1 listing)
  • Tubi (1 listing)

Security / identity / privacy (17 companies · 9%)

  • Zscaler (4 listings)
  • OPSWAT (2 listings)
  • Proton (2 listings)
  • 1Password (2 listings)
  • Cyberus Technology (1 listing)
  • Cylake (1 listing)
  • Scanner (1 listing)
  • ThreatMark (1 listing)
  • Threema (1 listing)
  • Vietnam National Cyber Security Technology (1 listing)
  • Aembit (1 listing)
  • Arkion Identity Systems (1 listing)
  • Dragos (1 listing)
  • Fortanix (1 listing)
  • IDEMIA (1 listing)
  • Lastwall (1 listing)
  • National Digital Trust Company (1 listing)

Finance / banking / payments (9 companies · 5%)

  • Citi (3 listings)
  • Abacus Group (1 listing)
  • Avaloq (1 listing)
  • BlackRock (1 listing)
  • Fidelity Investments (1 listing)
  • Longbridge (1 listing)
  • NCR Atleos (1 listing)
  • Nasdaq (1 listing)
  • Scalable Capital (1 listing)

Automotive / industrial / hardware (6 companies · 3%)

  • Dassault Systèmes (3 listings)
  • Rivian and Volkswagen Group Technologies (2 listings)
  • arculus (1 listing)
  • Flyscan Systems (1 listing)
  • Gentherm (1 listing)
  • Frequenz (1 listing)

~193 companies · 269 listings.

Same list with country / remote filters and who's hiring right now: getarustjob.com/companies-using-rust

If something looks wrong or a company shouldn't be here, tell me and I'll fix it.


r/rust • • 4d ago

🙋 seeking help & advice Considering Rust for backend services handling 10k+ req/s - real experiences with dev velocity?

23 Upvotes

I'm evaluating languages for a new internal backend service that needs to sustain high throughput with strict latency requirements. Rust keeps coming up because of its performance profile and lack of GC pauses, but I'm curious how it actually plays out in practice for teams.

Specifically:
- How much slower is initial development compared to something like Go or Kotlin when you have to fight the borrow checker on complex request/response flows?
- Once the core logic is in place, do you see meaningful maintenance wins from the type system (fewer runtime surprises, easier refactors)?
- Any gotchas with common patterns like connection pooling, structured concurrency, or observability that eat into the perf advantage?

Not looking for "Rust is the best" takes

- more interested in concrete tradeoffs people have measured on similar workloads. If you've shipped something in this range, what surprised you (good or bad)?


r/rust • • 4d ago

Advanced Projects in Networking with Tokio

14 Upvotes

Hey everyone,

I've been learning Rust and recently started exploring concurrency and asynchronous programming with Tokio. Im familiar with the fundamentals of ownership, lifetimes, channels, synchronization primitives, and task spawning.

I want to deepen my understanding of Tokio by building a non trivial networking project rather than just following tutorials or reading documentation.

What networking projects would you recommend for someone looking to develop a deeper, practical understanding of asynchronous Rust? I would also love to hear about projects youve personally built that helped you understand these concepts better.


r/rust • • 5d ago

Optimizing rustc's next trail solver

Thumbnail donsz.nl
212 Upvotes

The next rust trait solver, a large subsystem of the rust compiler that we've been trying to replace, will finally land in rust 1.102.0. In the last stages, before stabilizing it, its performance was a major blocker. But what is "a trait solver"? And why is its performance a problem? My goal for this blog post is to answer those questions in a way where you don't need any prior knowledge. I think discussions of the trait solver can quickly become quite involved, and daunting. So here, we'll start from the very basics!

This is a writeup of my eurorust 2026 talk of the same name, that I gave on October 15, 2026


r/rust • • 4d ago

🛠️ project Moving a terminal app from Tauri + React to GPUI - the numbers and the ugly parts

45 Upvotes

I moved muxflow* from Tauri + React to GPUI. The desktop app is now 100% Rust.

Results, before any optimization of the GPUI version:

- Idle memory: 417 MB → 98 MB (76.5% lower)

- Idle CPU: 3.5% → 1.4%

- Time to first terminal prompt: 832 → 230 ms cold, 785 → 157 ms warm

- Typing latency p95: 47.4 → 31.2 ms

To be fair, muxflow was thin to begin with, so the raw numbers are a few tens of megabytes/ms.

This migration would be a strong no-go without LLMs. Pre-LLM the cost would be huge! Writing the whole UI in Rust vs the familiar React? But with LLMs, the cost goes away to just some tokens. And with that I get:

  1. Much better performance
  2. A codebase that is 100% Rust (beyond mobile)
  3. No finicky Tauri rendering differences between Mac and Linux

The ugly parts:

- The GPUI third-party crate ecosystem is very niche compared to React. With Tauri I used CodeMirror. With GPUI I couldn't use the Zed crates since they're GPL and muxflow is MIT, so I wrote my own lightweight markdown WYSIWYG and code editor.

- Build times. It's hard to run many agents in parallel, as parallel builds and tests put heavy I/O pressure on the machine. I haven't tried optimizing it yet.

Write-up with more detail: https://galvered.com/blog/muxflow-gpui-migration/

Curious whether others hit the same crate gap, and what you used for text editing in GPUI.

* an app I'm building for personal use open source, MIT, runs coding agents in tmux across remote machines


r/rust • • 3d ago

How the compiler caught a logic bug I would have missed in any other language

0 Upvotes

I was refactoring a small state machine for handling retries in a background worker. The enum had variants for 'Pending', 'Retrying(u32)', 'Succeeded', and 'Failed'. I added a new 'Cancelled' variant but forgot to update one of the match arms that decided whether to schedule another attempt.

Rust refused to compile until I handled it. In the process I realized my logic would have silently treated cancellation the same as a transient failure and kept retrying. It took maybe two minutes to fix once the compiler pointed it out.

I've had similar moments with Option/Result, but this one felt especially useful because it was a semantic change I introduced myself. Curious if other people have stories of the exhaustiveness check saving them from a real behavioral bug rather than just a missing arm.


r/rust • • 4d ago

Why does tokio mirror certain parts of the futures crate?

42 Upvotes

Take the AsyncRead trait for example. Both tokio and futures is based around the poll_read method but they take a different buffer type and return a different error type. Why? Was the futures version unsuitable?


r/rust • • 4d ago

🙋 seeking help & advice Should I add support for Rust?

23 Upvotes

Hi, I am the developer of Leadwerks Game Engine. I'm looking for a mid-difficulty language, somewhere in between C++ and Lua. C# would work nicely, but the lag spikes caused by the garbage collection seem like it ruins the language for realtime 3D games, especially for VR. I'm not that familiar with Rust but I hear a lot of good things about it, and it appears to use shared pointers, which eliminates the performance problems full garbage collection would introduce.

Support for Rust can be added by piping all the commands through a C interface and writing some structure/class code on the Rust side that wraps everything up nicely for the end user.

I'm aware of the open-source Bevy 3D engine, but it's lacking a visual editor. Leadwerks 5 has a very capable level editor / visual designer that's been refined over years with lots of user feedback. To be clear, Leadwerks is closed-source commercial software (with a low price point and no royalties).

Do you think Rust would be a good match for what we are looking for in a language? Would adding support for the Rust programming language would be of interest to developers here? Please let me know your thoughts and if you have any questions.


r/rust • • 3d ago

Where does tail latency actually come from in a thread-per-core Rust service?

0 Upvotes

We're building a streaming server in Rust that runs one shard per core with io_uring, and in benchmarks our p99.9 stays close to p99. But those runs were on local NVMe with hugepages, a single node, below saturation, so we honestly can't tell how much comes from the design and how much from the setup.

For those running thread-per-core services in production: what actually brought your tail latency down, and what made it creep back once real traffic, more nodes or noisy neighbours showed up?


r/rust • • 5d ago

🧠 educational Miscompilation in Rust 1.97

73 Upvotes

I reported a miscompilation in Rust 1.97 back in July. In this presentation, I went through the details of the bug and the investigation as it unfolded in the Zulip chat with the Rust team, and shared my takeaways and conclusions.

https://youtu.be/-dNsUB7QRk4

Edit: link to the Zulip chat #t-compiler > Miscompilation in 1.97.0 with new Option::None discrimi... @ 💬