Skip to main content

assert_no_alloc

Function assert_no_alloc 

Source
pub fn assert_no_alloc<T, F: FnOnce() -> T>(func: F) -> T
Expand description

Calls the func closure, but forbids any (de)allocations.

If a call to the allocator is made, the program will abort with an error, print a warning (depending on the warn_debug feature flag. Or ignore the situation, when compiled in --release mode with the disable_release feature flag set (which is the default)).