pub struct LockResult<P> { /* private fields */ }Expand description
Type-erased result of locking a mutex-like or reader-writer lock pointer.
The type parameter P determines the capability of the returned pointer:
PtrConstfor read locks (shared access)PtrMutfor write/mutex locks (exclusive access)
Implementations§
Source§impl<P> LockResult<P>
impl<P> LockResult<P>
Sourcepub const unsafe fn new(
data: P,
guard: PtrConst,
guard_vtable: &'static LockGuardVTable,
) -> Self
pub const unsafe fn new( data: P, guard: PtrConst, guard_vtable: &'static LockGuardVTable, ) -> Self
Creates a new LockResult from its components.
§Safety
datamust point to valid data protected by the guardguardmust point to a valid guard that, when dropped viaguard_vtable.drop_in_place, will release the lock- The guard must outlive any use of
data
Source§impl LockResult<PtrMut>
impl LockResult<PtrMut>
Sourcepub const fn data_const(&self) -> PtrConst
pub const fn data_const(&self) -> PtrConst
Returns a const pointer to the locked data (convenience for write locks)
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for LockResult<P>where
P: Freeze,
impl<P> RefUnwindSafe for LockResult<P>where
P: RefUnwindSafe,
impl<P> !Send for LockResult<P>
impl<P> !Sync for LockResult<P>
impl<P> Unpin for LockResult<P>where
P: Unpin,
impl<P> UnwindSafe for LockResult<P>where
P: UnwindSafe,
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