Handling memory failure

⚓ Rust    📅 2026-01-01    👤 surdeus    👁️ 2      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Handling memory failure

Hi

Is there a way for a rust program to handle memory failure ?

like

let mut my_string = String::try_new()?;
my_string.try_push("test")?;

/// and the same for every other type like vec, map, etc...

Also, I thought about an interface, like thread::scope

fn main(){
   alloc::fallible(|| {
            // my code that can have memory failure
   })
}

Is there a book or a tutorial to make a safe-from-memory-failure rust program ?

Thanks

4 posts - 3 participants

Read full topic

🏷️ Rust_feed