[−][src]Function checkers::with_muted
pub fn with_muted<F, R>(f: F) -> R where
F: FnOnce() -> R,
Run the given closure while the allocator is muted. This can be used to whitelist sections of code where the allocation checker should be disabled.
See is_muted for details on what this means.
Examples
#[global_allocator] static ALLOCATOR: checkers::Allocator = checkers::Allocator::system(); lazy_static::lazy_static! { pub static ref EX: Box<u32> = checkers::with_muted(|| Box::new(123)); } let snapshot = checkers::with(|| { let _ = &*EX; }); // Snapshot can be successfully verified since we're excluding the static // allocation from analysis. checkers::verify!(snapshot);