Struct unique_token::Unique
source · [−]pub struct Unique(_);Expand description
This type represents a unique 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 carries an Arc
(not the std one, but a variant from triomphe
that doesn’t track weak references).
Equality checks are implemented as
a pointer check on the zero-sized type (unit)
inside the Arc.
Implementations
Trait Implementations
impl Eq for Unique
impl StructuralEq for Unique
Auto Trait Implementations
impl RefUnwindSafe for Unique
impl Send for Unique
impl Sync for Unique
impl Unpin for Unique
impl UnwindSafe for Unique
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more