[][src]Struct cmim::Move

pub struct Move<T, I> { /* fields omitted */ }

Methods

impl<T, I> Move<T, I>[src]

pub const fn new_uninitialized(inter: I) -> Self[src]

pub const fn new(data: T, inter: I) -> Self[src]

impl<T, I> Move<T, I> where
    T: Send + Sized,
    I: Nr
[src]

pub fn try_move(&self, data: T) -> Result<Option<T>, T>[src]

Attempt to initialize the data of the Move structure. This MUST be called from non-interrupt context, and a critical section will be in place while setting the data.

Returns:

  • Ok(Some(T)): If we are in thread mode and the data was previously initialized
  • Ok(None): If we are in thread mode and the data was not previously initialized
  • Err(()): If we are not in thread mode (e.g. an interrupt is active)

pub fn try_free(&self) -> Result<Option<T>, ()>[src]

Attempt to recover the data from the Move structure. This MUST be called from non-interrupt context, and a critical section will be in place while receiving the data.

Returns:

  • Ok(Some(T)): If we are in thread mode and the data was previously initialized
  • Ok(None): If we are in thread mode and the data was not previously initialized
  • Err(()): If we are not in thread mode (e.g. an interrupt is active)

pub fn try_lock<R>(&self, f: impl FnOnce(&mut T) -> R) -> Result<R, ()>[src]

So, this isn't a classical mutex. It will only provide access if:

  • The selected interrupt is currently active
  • The mutex has not already been locked

If these conditions are met, then you can access the variable from within a closure

Trait Implementations

impl<T, I> Sync for Move<T, I> where
    T: Send + Sized,
    I: Nr
[src]

Auto Trait Implementations

impl<T, I> Unpin for Move<T, I> where
    I: Unpin,
    T: Unpin

impl<T, I> Send for Move<T, I> where
    I: Send,
    T: Send

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self