pub struct PolicyMarker<P>(/* private fields */)
where
P: AllocPolicy;Expand description
Zero-sized type (ZST) that brands a data structure with the allocator
policy used to create it — zero runtime cost (PhantomData<P>).
Embed PolicyMarker<P> in consumer types to carry the policy as a
compile-time proof without any runtime overhead.
Implementations§
Source§impl<P> PolicyMarker<P>where
P: AllocPolicy,
impl<P> PolicyMarker<P>where
P: AllocPolicy,
Sourcepub const fn new() -> PolicyMarker<P>
pub const fn new() -> PolicyMarker<P>
Creates a new zero-cost marker.
Sourcepub const fn fingerprint() -> u64
pub const fn fingerprint() -> u64
Returns the compile-time policy fingerprint.
Sourcepub const fn mitigation_flags() -> u32
pub const fn mitigation_flags() -> u32
Returns the compile-time mitigation flags bitmask.
Trait Implementations§
Source§impl<P> Clone for PolicyMarker<P>where
P: AllocPolicy,
impl<P> Clone for PolicyMarker<P>where
P: AllocPolicy,
Source§fn clone(&self) -> PolicyMarker<P>
fn clone(&self) -> PolicyMarker<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<P> Copy for PolicyMarker<P>where
P: AllocPolicy,
Source§impl<P> Debug for PolicyMarker<P>where
P: AllocPolicy,
impl<P> Debug for PolicyMarker<P>where
P: AllocPolicy,
Source§impl<P> Default for PolicyMarker<P>where
P: AllocPolicy,
impl<P> Default for PolicyMarker<P>where
P: AllocPolicy,
Source§fn default() -> PolicyMarker<P>
fn default() -> PolicyMarker<P>
Returns the “default value” for a type. Read more
impl<P> Eq for PolicyMarker<P>where
P: AllocPolicy,
Auto Trait Implementations§
impl<P> Freeze for PolicyMarker<P>where
PhantomData<P>: Freeze,
impl<P> RefUnwindSafe for PolicyMarker<P>where
PhantomData<P>: RefUnwindSafe,
impl<P> Send for PolicyMarker<P>where
PhantomData<P>: Send,
impl<P> Sync for PolicyMarker<P>where
PhantomData<P>: Sync,
impl<P> Unpin for PolicyMarker<P>where
PhantomData<P>: Unpin,
impl<P> UnsafeUnpin for PolicyMarker<P>where
PhantomData<P>: UnsafeUnpin,
impl<P> UnwindSafe for PolicyMarker<P>where
PhantomData<P>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more