pub struct TicketMutexGuard<'a, T: ?Sized + 'a> { /* private fields */ }
Available on crate features
mutex
and ticket_mutex
only.Expand description
A guard that protects some data.
When the guard is dropped, the next ticket will be processed.
Implementations§
Source§impl<'a, T: ?Sized> TicketMutexGuard<'a, T>
impl<'a, T: ?Sized> TicketMutexGuard<'a, T>
Sourcepub fn leak(this: Self) -> &'a mut T
pub fn leak(this: Self) -> &'a mut T
Leak the lock guard, yielding a mutable reference to the underlying data.
Note that this function will permanently lock the original TicketMutex
.
let mylock = spin::mutex::TicketMutex::<_>::new(0);
let data: &mut i32 = spin::mutex::TicketMutexGuard::leak(mylock.lock());
*data = 1;
assert_eq!(*data, 1);
Trait Implementations§
Source§impl<'a, T: ?Sized> Deref for TicketMutexGuard<'a, T>
impl<'a, T: ?Sized> Deref for TicketMutexGuard<'a, T>
Source§impl<'a, T: ?Sized> DerefMut for TicketMutexGuard<'a, T>
impl<'a, T: ?Sized> DerefMut for TicketMutexGuard<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for TicketMutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for TicketMutexGuard<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for TicketMutexGuard<'a, T>
impl<'a, T> Sync for TicketMutexGuard<'a, T>
impl<'a, T> Unpin for TicketMutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> !UnwindSafe for TicketMutexGuard<'a, T>
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
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.