pub struct AtomicCheckMutex<BUS> { /* private fields */ }
Expand description

A simple coherency checker for sharing across multiple tasks/threads.

This mutex type can be used when all bus users are contained in a single structure, and is intended for use with RTIC. When all bus users are contained within a structure managed by RTIC, RTIC will guarantee that bus collisions do not occur. To protect against accidentaly misuse, this mutex uses an atomic bool to determine when the bus is in use. If a bus collision is detected, the code will panic.

This mutex type is used with the BusManagerAtomicMutex type.

This manager type is explicitly safe to share across threads because it checks to ensure that collisions due to bus sharing do not occur.

Trait Implementations§

source§

impl<BUS> BusMutex for AtomicCheckMutex<BUS>

§

type Bus = BUS

The actual bus that is wrapped inside this mutex.
source§

fn create(v: BUS) -> Self

Create a new mutex of this type.
source§

fn lock<R, F: FnOnce(&mut Self::Bus) -> R>(&self, f: F) -> R

Lock the mutex and give a closure access to the bus inside.
source§

impl<BUS: Debug> Debug for AtomicCheckMutex<BUS>

source§

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

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

impl<BUS> Sync for AtomicCheckMutex<BUS>

Auto Trait Implementations§

§

impl<BUS> !RefUnwindSafe for AtomicCheckMutex<BUS>

§

impl<BUS> Send for AtomicCheckMutex<BUS>where BUS: Send,

§

impl<BUS> Unpin for AtomicCheckMutex<BUS>where BUS: Unpin,

§

impl<BUS> UnwindSafe for AtomicCheckMutex<BUS>where BUS: UnwindSafe,

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, 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, 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.