Skip to main content

AtomicMmio

Trait AtomicMmio 

Source
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§

Source

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

Source

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

Source

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§

Source

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

Source

fn fetch_and<T: AtomicOperand>(&self, offset: usize, value: T) -> T

Atomic fetch_and with value at offset.

§Panics

Panics if offset is invalid (unaligned or out of bounds for T).

Source

fn fetch_or<T: AtomicOperand>(&self, offset: usize, value: T) -> T

Atomic fetch_or with 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".

Implementations on Foreign Types§

Source§

impl<Impl: AtomicMmioPtr + UnsafeMmio, Owner: Borrow<Impl>> AtomicMmio for MmioRegion<Impl, Owner>

Source§

fn try_swap<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>

Source§

fn try_fetch_and<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>

Source§

fn try_fetch_or<T: AtomicOperand>( &self, offset: usize, value: T, ) -> Result<T, MmioError>

Implementors§