pub trait AtomicMmio {
// Required methods
fn try_swap<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>;
fn try_fetch_and<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>;
fn try_fetch_or<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>;
// Provided methods
fn swap<T: AtomicOperand>(&self, offset: usize, value: T) -> T { ... }
fn fetch_and<T: AtomicOperand>(&self, offset: usize, value: T) -> T { ... }
fn fetch_or<T: AtomicOperand>(&self, offset: usize, value: T) -> T { ... }
}Expand description
An extension trait applied to MmioRegion to support atomic operations.
All atomic operations are performed with Ordering::SeqCst.
Required Methods§
Sourcefn try_swap<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>
fn try_swap<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>
Try atomic swap of value at offset.
Returns an error if offset is invalid (unaligned or out of bounds for T).
Sourcefn try_fetch_and<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>
fn try_fetch_and<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>
Try atomic fetch_and with value at offset.
Returns an error if offset is invalid (unaligned or out of bounds for T).
Sourcefn try_fetch_or<T: AtomicOperand>(
&self,
offset: usize,
value: T,
) -> Result<T, MmioError>
fn try_fetch_or<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>
Try atomic fetch_or with value at offset.
Returns an error if offset is invalid (unaligned or out of bounds for T).
Provided Methods§
Sourcefn swap<T: AtomicOperand>(&self, offset: usize, value: T) -> T
fn swap<T: AtomicOperand>(&self, offset: usize, value: T) -> T
Atomic swap of value at offset.
§Panics
Panics if offset is invalid (unaligned or out of bounds for T).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".