[−][src]Struct debug_tag::DebugTag
A value that guarentees that if two DebugTag
s are not equal, then they are not clones.
This can be used to tag information during debug, such that the use of a value can be tracked and checked. For example, you can use this to ensure (in debug) that a value returned by a data structure is only used with the instance that returned the value.
This tagging is only done if debug_assertions
is set. If debug_assertions
is not set, then
all DebugTags
are equal. Even if debug_assertions
is set, two DebugTag
s that are not
clones can still be equal. This is unlikely, however.
Therefore, functionality should not directly depend on the equality these tags but only use them for additional sanity checks.
Methods
impl DebugTag
[src]
pub fn new() -> DebugTag
[src]
Creates a new DebugTag
pub const fn from(_tag: u32) -> DebugTag
[src]
Create a new tag with the specified value.
Prefer using new
instead, which will generate a value. Use this only in cases where that
is not possible, like when creating a const debug tag.
The tag value should be a randomly chosen constant.
Trait Implementations
impl Clone for DebugTag
[src]
impl Copy for DebugTag
[src]
impl Debug for DebugTag
[src]
impl Default for DebugTag
[src]
impl Eq for DebugTag
[src]
impl PartialEq<DebugTag> for DebugTag
[src]
impl StructuralEq for DebugTag
[src]
impl StructuralPartialEq for DebugTag
[src]
Auto Trait Implementations
impl RefUnwindSafe for DebugTag
impl Send for DebugTag
impl Sync for DebugTag
impl Unpin for DebugTag
impl UnwindSafe for DebugTag
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,