pub struct Unique(/* private fields */);
Expand description
This type represents a unique token.
Each call to Unique::new()
returns a unique value.
The only way to create a token that compares equal is to
clone or copy an existing token.
§Examples
use unique_token::Unique;
let x = Unique::new();
let y = Unique::new();
// clones are equal
assert_eq!(x, x.clone());
assert_eq!(y, y.clone());
// tokens from different calls are unequal
assert_ne!(x, y);
§Implementation
Each token is provided with a unique ID
by incrementing a static AtomicU64
.
Implementations§
Trait Implementations§
impl Copy for Unique
impl Eq for Unique
impl StructuralPartialEq for Unique
Auto Trait Implementations§
impl Freeze for Unique
impl RefUnwindSafe for Unique
impl Send for Unique
impl Sync for Unique
impl Unpin for Unique
impl UnwindSafe for Unique
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