Skip to main content

SpinRwLock

Struct SpinRwLock 

Source
pub struct SpinRwLock<T: ?Sized> { /* private fields */ }
Expand description

A non-sleeping read-write lock.

Implementations§

Source§

impl<T> SpinRwLock<T>

Source

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

Creates an unlocked spin read-write lock.

Source

pub fn into_inner(self) -> T

Consumes the lock and returns the protected value.

Source§

impl<T: ?Sized> SpinRwLock<T>

Source

pub fn read(&self) -> SpinRwLockReadGuard<'_, T>

Acquires a read guard after disabling preemption.

Source

pub fn try_read(&self) -> Option<SpinRwLockReadGuard<'_, T>>

Attempts a read acquisition after disabling preemption.

Source

pub fn write(&self) -> SpinRwLockWriteGuard<'_, T>

Acquires a write guard after disabling preemption.

Source

pub fn try_write(&self) -> Option<SpinRwLockWriteGuard<'_, T>>

Attempts a write acquisition after disabling preemption.

Source

pub fn read_irqsave(&self) -> SpinRwLockIrqSaveReadGuard<'_, T>

Acquires an IRQ-save read guard.

Source

pub fn try_read_irqsave(&self) -> Option<SpinRwLockIrqSaveReadGuard<'_, T>>

Attempts an IRQ-save read acquisition.

Source

pub fn write_irqsave(&self) -> SpinRwLockIrqSaveWriteGuard<'_, T>

Acquires an IRQ-save write guard.

Source

pub fn try_write_irqsave(&self) -> Option<SpinRwLockIrqSaveWriteGuard<'_, T>>

Attempts an IRQ-save write acquisition.

Source

pub unsafe fn read_raw(&self) -> RawSpinRwLockReadGuard<'_, T>

Acquires a raw read guard.

§Safety

The caller must prevent re-entry and uphold shared exclusion.

Source

pub unsafe fn try_read_raw(&self) -> Option<RawSpinRwLockReadGuard<'_, T>>

Attempts a raw read acquisition.

§Safety

The caller must uphold the contract of Self::read_raw.

Source

pub unsafe fn write_raw(&self) -> RawSpinRwLockWriteGuard<'_, T>

Acquires a raw write guard.

§Safety

The caller must prevent re-entry and concurrent readers or writers.

Source

pub unsafe fn try_write_raw(&self) -> Option<RawSpinRwLockWriteGuard<'_, T>>

Attempts a raw write acquisition.

§Safety

The caller must uphold the contract of Self::write_raw.

Source

pub fn get_mut(&mut self) -> &mut T

Returns exclusive access without locking.

Trait Implementations§

Source§

impl<T: Debug> Debug for SpinRwLock<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for SpinRwLock<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> From<T> for SpinRwLock<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: ?Sized + Send + Sync> Send for SpinRwLock<T>

Source§

impl<T: ?Sized + Send + Sync> Sync for SpinRwLock<T>

Auto Trait Implementations§

§

impl<T> !Freeze for SpinRwLock<T>

§

impl<T> !RefUnwindSafe for SpinRwLock<T>

§

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

§

impl<T> UnsafeUnpin for SpinRwLock<T>
where T: UnsafeUnpin + ?Sized,

§

impl<T> UnwindSafe for SpinRwLock<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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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.