Struct isotp_rs::AtomicState
source · pub struct AtomicState(/* private fields */);Expand description
A wrapper around AtomicU8 for IsoTpState with atomic operations.
Implementations§
source§impl AtomicState
impl AtomicState
sourcepub fn new(state: IsoTpState) -> Self
pub fn new(state: IsoTpState) -> Self
Creates a new AtomicState with the initial state.
sourcepub fn load(&self, order: Ordering) -> IsoTpState
pub fn load(&self, order: Ordering) -> IsoTpState
Loads the current state.
sourcepub fn store(&self, state: IsoTpState, order: Ordering)
pub fn store(&self, state: IsoTpState, order: Ordering)
Stores a new state.
sourcepub fn fetch_update(
&self,
set_order: Ordering,
fetch_order: Ordering,
f: impl FnMut(IsoTpState) -> Option<IsoTpState>,
) -> Result<IsoTpState, IsoTpState>
pub fn fetch_update( &self, set_order: Ordering, fetch_order: Ordering, f: impl FnMut(IsoTpState) -> Option<IsoTpState>, ) -> Result<IsoTpState, IsoTpState>
Updates the state using the provided function.
sourcepub fn fetch_add(
&self,
flags: IsoTpState,
success: Ordering,
failure: Ordering,
) -> Result<IsoTpState, IsoTpState>
pub fn fetch_add( &self, flags: IsoTpState, success: Ordering, failure: Ordering, ) -> Result<IsoTpState, IsoTpState>
Performs an atomic addition of flags to the current state.
sourcepub fn fetch_remove(
&self,
flags: IsoTpState,
success: Ordering,
failure: Ordering,
) -> Result<IsoTpState, IsoTpState>
pub fn fetch_remove( &self, flags: IsoTpState, success: Ordering, failure: Ordering, ) -> Result<IsoTpState, IsoTpState>
Performs an atomic removal of flags from the current state.
Trait Implementations§
source§impl Debug for AtomicState
impl Debug for AtomicState
Auto Trait Implementations§
impl !Freeze for AtomicState
impl RefUnwindSafe for AtomicState
impl Send for AtomicState
impl Sync for AtomicState
impl Unpin for AtomicState
impl UnwindSafe for AtomicState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more