Struct intern_all::Tok
source · pub struct Tok<T: Eq + Hash + Clone + Send + Sync + 'static> { /* private fields */ }Expand description
A shared instance. Equality comparison costs two pointer comparisons. Ordering is by pointer value.
Panics
If an interner was manually constructed, tokens from different interners cannot be compared and attempting to do so causes a panic.
Since a given Interner uses a single TypedInterner for each type, this is only possible if an Interner or TypedInterner was constructed besides the singleton.
Implementations§
source§impl<T: Eq + Hash + Clone + Send + Sync + 'static> Tok<T>
impl<T: Eq + Hash + Clone + Send + Sync + 'static> Tok<T>
sourcepub fn id(&self) -> NonZeroUsize
pub fn id(&self) -> NonZeroUsize
The pointer value of the token. If this is equal, equality comparison succeeds.
sourcepub fn interner_id(&self) -> NonZeroUsize
pub fn interner_id(&self) -> NonZeroUsize
The pointer value of the interner. If this is different, comparison panics.
sourcepub fn assert_comparable(&self, other: &Self)
pub fn assert_comparable(&self, other: &Self)
Panic if the two tokens weren’t created with the same interner
sourcepub fn interner(&self) -> Arc<TypedInterner<T>>
pub fn interner(&self) -> Arc<TypedInterner<T>>
Get the typed interner that owns this token.
pub fn i<Q>(q: &Q) -> Self
Trait Implementations§
source§impl<T: Eq + Hash + Clone + Send + Sync + 'static> Ord for Tok<T>
impl<T: Eq + Hash + Clone + Send + Sync + 'static> Ord for Tok<T>
source§impl<T: Eq + Hash + Clone + Send + Sync + 'static> PartialEq for Tok<T>
impl<T: Eq + Hash + Clone + Send + Sync + 'static> PartialEq for Tok<T>
source§impl<T: Eq + Hash + Clone + Send + Sync + 'static> PartialOrd for Tok<T>
impl<T: Eq + Hash + Clone + Send + Sync + 'static> PartialOrd for Tok<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Eq + Hash + Clone + Send + Sync + 'static> Eq for Tok<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Tok<T>where
T: RefUnwindSafe,
impl<T> Send for Tok<T>
impl<T> Sync for Tok<T>
impl<T> Unpin for Tok<T>
impl<T> UnwindSafe for Tok<T>where
T: RefUnwindSafe,
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