[−][src]Macro core_extensions::unsafe_
Macro for correctly using unsafe{} blocks inside functions that take IsUnsafe references.
This macro ensures that an IsUnsafe reference was provided to use an unsafe block.
For more information about IsUnsafe/IsSafe/MaybeUnsafe look at the maybe_unsafe module
Example
use core_extensions::maybe_unsafe::IsUnsafe; use std::mem; /// Returns a zero initialized Copy value. /// /// # Safety /// /// 0 must be a valid bitpattern for the returned value. fn zeroed_copy<T>(safety:&IsUnsafe)->T where T:Copy, { unsafe_!{safety=> mem::zeroed() } }