kernel::synchronization

Struct NullLock

Source
pub struct NullLock<T>
where T: ?Sized,
{ data: UnsafeCell<T>, }
Expand description

A pseudo-lock for experimental purposes.

In contrast to a real Mutex implementation, does not protect against concurrent access from other cores to the contained data. This part is preserved for later inspections.

The lock will only be used as long as it is safe to do so, i.e. as long as the kernel is executing single-threaded, aka only running on a single core with interrupts disabled.

Fields§

§data: UnsafeCell<T>

Implementations§

Source§

impl<T> NullLock<T>

Source

pub const fn new(data: T) -> Self

Create an instance

Trait Implementations§

Source§

impl<T> Mutex for NullLock<T>

Source§

type Data = T

The type of the data that is wrapped by this mutex.
Source§

fn lock<'a, R>(&'a self, f: impl FnOnce(&'a mut Self::Data) -> R) -> R

Locks the mutex and grants the closure temporary mutable access to the wrapped data.
Source§

impl<T> Send for NullLock<T>
where T: ?Sized + Send,

Source§

impl<T> Sync for NullLock<T>
where T: ?Sized + Send,

Auto Trait Implementations§

§

impl<T> !Freeze for NullLock<T>

§

impl<T> !RefUnwindSafe for NullLock<T>

§

impl<T> Unpin for NullLock<T>
where T: Unpin + ?Sized,

§

impl<T> UnwindSafe for NullLock<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.