std::alloc::handle_alloc_error - Rust
Description: API documentation for the Rust `handle_alloc_error` fn in crate `std`.
Keywords: rust, rustlang, rust-lang, handle_alloc_error

# 1.28.0[−][src]Function std::alloc::handle_alloc_error

    pub fn handle_alloc_error(layout: Layout) -> !

Abort on memory allocation error or failure.

Callers of memory allocation APIs wishing to abort computation in response to an allocation error are encouraged to call this function, rather than directly invoking `panic!` or similar.

The default behavior of this function is to print a message to standard error and abort the process. It can be replaced with `set_alloc_error_hook` and `take_alloc_error_hook`.