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

# 1.28.0[−][src]Function alloc::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`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)