[−][src]Struct cmim::Move
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]
T: Send + Sized,
I: Nr,
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
Auto Trait Implementations
impl<T, I> Unpin for Move<T, I> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<T, I> Send for Move<T, I> where
I: Send,
T: Send,
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]
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>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self