Lines Matching full:guard
37 /// let mut guard = xa.lock();
39 /// assert_eq!(guard.get(0), None);
41 /// assert_eq!(guard.store(0, dead, GFP_KERNEL)?.as_deref(), None);
42 /// assert_eq!(guard.get(0).copied(), Some(0xdead));
44 /// *guard.get_mut(0).unwrap() = 0xffff;
45 /// assert_eq!(guard.get(0).copied(), Some(0xffff));
47 /// assert_eq!(guard.store(0, beef, GFP_KERNEL)?.as_deref().copied(), Some(0xffff));
48 /// assert_eq!(guard.get(0).copied(), Some(0xbeef));
50 /// guard.remove(0);
51 /// assert_eq!(guard.get(0), None);
122 pub fn try_lock(&self) -> Option<Guard<'_, T>> { in try_lock()
125 Some(Guard { in try_lock()
135 pub fn lock(&self) -> Guard<'_, T> { in lock()
139 Guard { in lock()
146 /// A lock guard.
148 /// The lock is unlocked when the guard goes out of scope.
149 #[must_use = "the lock unlocks immediately when the guard is unused"]
150 pub struct Guard<'a, T: ForeignOwnable> { struct
155 impl<T: ForeignOwnable> Drop for Guard<'_, T> { implementation
164 /// The error returned by [`store`](Guard::store).
180 impl<'a, T: ForeignOwnable> Guard<'a, T> { impl