Struct kernel::sync::lock::Guard

source ·
pub struct Guard<'a, T: ?Sized, B: Backend> { /* private fields */ }
Expand description

A lock guard.

Allows mutual exclusion primitives that implement the Backend trait to automatically unlock when a guard goes out of scope. It also provides a safe and convenient way to access the data protected by the lock.

Trait Implementations§

source§

impl<T: ?Sized, B: Backend> Deref for Guard<'_, T, B>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ?Sized, B: Backend> DerefMut for Guard<'_, T, B>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: ?Sized, B: Backend> Drop for Guard<'_, T, B>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Sync + ?Sized, B: Backend> Sync for Guard<'_, T, B>

Auto Trait Implementations§

§

impl<'a, T, B> !RefUnwindSafe for Guard<'a, T, B>

§

impl<'a, T, B> !Send for Guard<'a, T, B>

§

impl<'a, T: ?Sized, B> Unpin for Guard<'a, T, B>where <B as Backend>::GuardState: Unpin,

§

impl<'a, T, B> !UnwindSafe for Guard<'a, T, B>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, E> Init<T, E> for T

source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, E> PinInit<T, E> for T

source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.