[−][src]Attribute Macro alloc_counter_macro::no_alloc
#[no_alloc]
Macro for marking functions as unable to allocate.
By default, will panic on allocations not running in an allow_alloc
closure.
To panic on all allocations, use #[no_alloc(forbid)]
. To conditionally enable
panicking, the attribute can be wrapped:
ⓘThis example is not tested
// Panic only when running debug builds #[cfg_attr(debug_assertions, no_alloc)] fn my_function() { }