Struct tokenlock::SingletonTokenGuard [−][src]
The RAII guard for a SingletonToken
obtained through
SingletonToken::new
. Returns the token to the factory automatically
when dropped.
The second type parameter (Variant
) is internal use only and exempt from
the API stability guarantee.
Implementations
impl<Tag: ?Sized + SingletonTokenFactory> SingletonTokenGuard<Tag>
[src]
pub fn into_unsync(self) -> UnsyncSingletonTokenGuard<Tag>
[src]
Convert SingletonTokenGuard
to the !Sync
variant.
impl<Tag: ?Sized + SingletonTokenFactory> SingletonTokenGuard<Tag, UnsyncVariant>
[src]
pub fn into_sync(self) -> SingletonTokenGuard<Tag>
[src]
Convert UnsyncSingletonToken
to the Sync
variant.
Methods from Deref<Target = SingletonToken<Tag, Variant>>
pub fn id(&self) -> SingletonTokenId<Tag>
[src]
Construct an SingletonTokenId
that equates to self
.
pub fn borrow(&self) -> SingletonTokenRef<'_, Tag, Variant>
[src]
Borrow self
as SingletonTokenRef
or UnsyncSingletonTokenRef
of the same Sync
-ness as Self
.
SingletonTokenRef
is truly zero-sized, so it's more efficient to
store and pass than &SingletonToken
.
pub fn borrow_mut(&mut self) -> SingletonTokenRefMut<'_, Tag, Variant>
[src]
Borrow self
mutably as SingletonTokenRefMut
or UnsyncSingletonTokenRefMut
of the same Sync
-ness as Self
.
SingletonTokenRefMut
is truly zero-sized, so it's more efficient to
store and pass than &mut SingletonToken
.
pub fn borrow_sync(&self) -> SingletonTokenRef<'_, Tag>
[src]
Borrow self: UnsyncSingletonToken
as SingletonTokenRef
.
pub fn borrow_sync_mut(&mut self) -> SingletonTokenRefMut<'_, Tag>
[src]
Borrow self: UnsyncSingletonToken
mutably as SingletonTokenRefMut
.
pub fn borrow_unsync_mut(&mut self) -> UnsyncSingletonTokenRefMut<'_, Tag>
[src]
Borrow self: SingletonToken
mutably as UnsyncSingletonTokenRefMut
.
There is no borrow_unsync
because that would allow
UnsyncSingletonToken
to be logically borrowed by multiple threads.
Trait Implementations
impl<Tag: ?Sized + SingletonTokenFactory, Variant: SingletonTokenVariant> Deref for SingletonTokenGuard<Tag, Variant>
[src]
type Target = SingletonToken<Tag, Variant>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<Tag: ?Sized + SingletonTokenFactory, Variant: SingletonTokenVariant> DerefMut for SingletonTokenGuard<Tag, Variant>
[src]
impl<Tag: ?Sized + SingletonTokenFactory, Variant> Drop for SingletonTokenGuard<Tag, Variant>
[src]
Auto Trait Implementations
impl<Tag: ?Sized, Variant> RefUnwindSafe for SingletonTokenGuard<Tag, Variant> where
Variant: RefUnwindSafe,
[src]
Variant: RefUnwindSafe,
impl<Tag: ?Sized, Variant> Send for SingletonTokenGuard<Tag, Variant> where
Variant: Send,
[src]
Variant: Send,
impl<Tag: ?Sized, Variant> Sync for SingletonTokenGuard<Tag, Variant> where
Variant: Sync,
[src]
Variant: Sync,
impl<Tag: ?Sized, Variant> Unpin for SingletonTokenGuard<Tag, Variant> where
Variant: Unpin,
[src]
Variant: Unpin,
impl<Tag: ?Sized, Variant> UnwindSafe for SingletonTokenGuard<Tag, Variant> where
Variant: UnwindSafe,
[src]
Variant: UnwindSafe,
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,
pub 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, 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.
pub 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>,