pub trait MetadataValue: Unsigned + Zero + WrappingAdd + WrappingSub + Bits + BitwiseOps + ToPrimitive + Copy + FromPrimitive + Display + Debug {
    // Required methods
    unsafe fn load(addr: Address) -> Self;
    unsafe fn load_atomic(addr: Address, order: Ordering) -> Self;
    unsafe fn store(addr: Address, value: Self);
    unsafe fn store_atomic(addr: Address, value: Self, order: Ordering);
    unsafe fn compare_exchange(
        addr: Address,
        current: Self,
        new: Self,
        success: Ordering,
        failure: Ordering
    ) -> Result<Self, Self>;
    unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self;
    unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self;
    unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self;
    unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self;
    unsafe fn fetch_update<F>(
        addr: Address,
        set_order: Ordering,
        fetch_order: Ordering,
        f: F
    ) -> Result<Self, Self>
       where F: FnMut(Self) -> Option<Self>;
}
Expand description

The number type for accessing metadata. It requires a few traits from num-traits and a few traits we defined above. The methods in this trait are mostly about atomically accessing such types.

Required Methods§

source

unsafe fn load(addr: Address) -> Self

Non atomic load

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type. The caller also needs to be aware that the method is not thread safe, as it is a non-atomic operation.

source

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

Atomic load

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn store(addr: Address, value: Self)

Non atomic store

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type. The caller also needs to be aware that the method is not thread safe, as it is a non-atomic operation.

source

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

Atomic store

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type. The caller also needs to be aware that the method is not thread safe, as it is a non-atomic operation.

source

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

source

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

§Safety

The caller needs to guarantee that the address is valid, and can be used as a pointer to the type.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MetadataValue for u8

source§

unsafe fn load(addr: Address) -> Self

source§

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

source§

unsafe fn store(addr: Address, value: Self)

source§

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

source§

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

source§

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

source§

impl MetadataValue for u16

source§

unsafe fn load(addr: Address) -> Self

source§

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

source§

unsafe fn store(addr: Address, value: Self)

source§

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

source§

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

source§

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

source§

impl MetadataValue for u32

source§

unsafe fn load(addr: Address) -> Self

source§

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

source§

unsafe fn store(addr: Address, value: Self)

source§

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

source§

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

source§

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

source§

impl MetadataValue for u64

source§

unsafe fn load(addr: Address) -> Self

source§

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

source§

unsafe fn store(addr: Address, value: Self)

source§

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

source§

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

source§

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

source§

impl MetadataValue for usize

source§

unsafe fn load(addr: Address) -> Self

source§

unsafe fn load_atomic(addr: Address, order: Ordering) -> Self

source§

unsafe fn store(addr: Address, value: Self)

source§

unsafe fn store_atomic(addr: Address, value: Self, order: Ordering)

source§

unsafe fn compare_exchange( addr: Address, current: Self, new: Self, success: Ordering, failure: Ordering ) -> Result<Self, Self>

source§

unsafe fn fetch_add(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_sub(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_and(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_or(addr: Address, value: Self, order: Ordering) -> Self

source§

unsafe fn fetch_update<F>( addr: Address, set_order: Ordering, fetch_order: Ordering, f: F ) -> Result<Self, Self>
where F: FnMut(Self) -> Option<Self>,

Implementors§