Trait OomHandler

Source
pub trait OomHandler: Sized {
    // Required method
    fn handle_oom(talc: &mut Talc<Self>, layout: Layout) -> Result<(), ()>;
}

Required Methods§

Source

fn handle_oom(talc: &mut Talc<Self>, layout: Layout) -> Result<(), ()>

Given the allocator and the layout of the allocation that caused OOM, resize or claim and return Ok(()) or fail by returning Err(()).

This function is called repeatedly if the allocator is still out of memory. Therefore an infinite loop will occur if Ok(()) is repeatedly returned without extending or claiming new memory.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§