BlockingMutex

Struct BlockingMutex 

Source
pub struct BlockingMutex<R: RawMutex, T> { /* private fields */ }
Expand description

A wrap of std::sync::Mutex. This type’s purpose is to allow choosing between using std::sync::Mutex or BlockingMutex through feature flags.

Implementations§

Source§

impl<R: RawMutex, T> BlockingMutex<R, T>

Source

pub const fn new(val: T) -> BlockingMutex<R, T>

Creates a new Mutex.

Source

pub fn lock(&self) -> MutexGuard<'_, T>

lock

Source

pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>

try_lock

Source

pub fn with_lock<U>(&self, f: impl FnOnce(&mut T) -> U) -> U

try_with_lock

Source

pub fn try_with_lock<U>(&self, f: impl FnOnce(&mut T) -> U) -> Option<U>

try_with_lock

Auto Trait Implementations§

§

impl<R, T> !Freeze for BlockingMutex<R, T>

§

impl<R, T> RefUnwindSafe for BlockingMutex<R, T>
where R: RefUnwindSafe,

§

impl<R, T> Send for BlockingMutex<R, T>
where T: Send, R: Send,

§

impl<R, T> Sync for BlockingMutex<R, T>
where T: Send, R: Sync,

§

impl<R, T> Unpin for BlockingMutex<R, T>
where R: Unpin, T: Unpin,

§

impl<R, T> UnwindSafe for BlockingMutex<R, T>
where R: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.