pub struct LockToken<'a, Class> { /* private fields */ }Expand description
A token proving that a lock of lock class Class is currently held by the current thread.
This token acts as a static proof to permit type-safe borrow access to cell values guarded by
this lock class (via KCell).
Implementations§
Source§impl<'a, Class> LockToken<'a, Class>
impl<'a, Class> LockToken<'a, Class>
Sourcepub unsafe fn new() -> Self
pub unsafe fn new() -> Self
Creates a new proof token for the lock class Class.
§Safety
The caller must guarantee that the mutual exclusion lock associated with this lock class is
currently held by the current thread and that the lifetime 'a is bounded to the duration
of the lock being held. Creating a token when the lock is not held, or letting the token
outlive the lock hold duration, can lead to concurrent mutation or data races, which is
undefined behavior.
Auto Trait Implementations§
impl<'a, Class> Freeze for LockToken<'a, Class>
impl<'a, Class> RefUnwindSafe for LockToken<'a, Class>where
Class: RefUnwindSafe,
impl<'a, Class> !Send for LockToken<'a, Class>
impl<'a, Class> !Sync for LockToken<'a, Class>
impl<'a, Class> Unpin for LockToken<'a, Class>
impl<'a, Class> UnsafeUnpin for LockToken<'a, Class>
impl<'a, Class> UnwindSafe for LockToken<'a, Class>where
Class: 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
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot. Read more