MutexImpl

Struct MutexImpl 

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

Mutual exclusion access to a contained value. Can be recursive - the current owner of a lock can re-lock it.

Implementations§

Source§

impl<T, M> MutexImpl<T, M>
where M: MutexInnerImpl,

Source

pub fn new(value: T) -> Result<Self, FreeRtosError>

Create a new mutex with the given inner value

Source

pub fn lock<D: DurationTicks>( &self, max_wait: D, ) -> Result<MutexGuard<'_, T, M>, FreeRtosError>

Try to obtain a lock and mutable access to our inner value

Source

pub fn into_inner(self) -> T

Consume the mutex and return its inner value

Source

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

Get mutable reference to inner value.

This method does not lock the mutex because mutable reference guarantees exclusive access.

Source

pub fn from_parts(mutex: M, value: T) -> Self

Create owning mutex from non-owning mutex and inner value.

It is safe to pass an already locked mutex although it is not recommended.

Source

pub fn into_parts(self) -> (M, T)

Split owning mutex into non-owning mutex and inner value.

Source

pub fn inner_mutex_mut(&mut self) -> &mut M

Get mutable reference to inner non-owning mutex.

Trait Implementations§

Source§

impl<T: ?Sized, M> Debug for MutexImpl<T, M>
where M: MutexInnerImpl + Debug,

Source§

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

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

impl<T: Send, M> Send for MutexImpl<T, M>

Source§

impl<T: Send, M> Sync for MutexImpl<T, M>

Auto Trait Implementations§

§

impl<T, M> !Freeze for MutexImpl<T, M>

§

impl<T, M> !RefUnwindSafe for MutexImpl<T, M>

§

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

§

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

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.