[][src]Struct debug_tag::DebugTag

#[non_exhaustive]pub struct DebugTag(_);

A value that guarentees that if two DebugTags 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 DebugTags 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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.