rstubs::arch::io

Trait VolatileUpdate

source
pub trait VolatileUpdate<T> {
    // Required method
    unsafe fn update_volatile(&self, f: impl FnOnce(T) -> T);
}
Expand description

Extension for pointers, that provides a volatile update function (read->modify->write)

Required Methods§

source

unsafe fn update_volatile(&self, f: impl FnOnce(T) -> T)

Reads from the memory address, passes the value to f, and writes the value it returns back to memory.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> VolatileUpdate<T> for *mut T

source§

unsafe fn update_volatile(&self, f: impl FnOnce(T) -> T)

Implementors§