Skip to main content

WriteOneToClear

Struct WriteOneToClear 

Source
pub struct WriteOneToClear<T>(/* private fields */);
Expand description

A handler implementation that fakes write-1-to-clear registers of width T.

WriteOneToClear replaces every store of v with a fetch_and(!v), which has the final effect of faking registers that clear the set bits on write.

The handler panics on both loads and stores if the operand width does not match T.

Implementations§

Source§

impl<T> WriteOneToClear<T>

Source

pub fn new() -> Self

Creates a new write-1-to-clear handler.

Trait Implementations§

Source§

impl<T> Default for WriteOneToClear<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> GenericVmoMemoryHandler for WriteOneToClear<T>

Source§

fn load<X: MmioOperand>(&self, op: VmoOpHelper<'_, X>) -> X

Handles an MMIO load operation for type T.
Source§

fn store<X: MmioOperand>(&self, op: VmoOpHelper<'_, X>, value: X)

Handles an MMIO store operation for type T.

Auto Trait Implementations§

§

impl<T> Freeze for WriteOneToClear<T>

§

impl<T> RefUnwindSafe for WriteOneToClear<T>
where T: RefUnwindSafe,

§

impl<T> Send for WriteOneToClear<T>
where T: Send,

§

impl<T> Sync for WriteOneToClear<T>
where T: Sync,

§

impl<T> Unpin for WriteOneToClear<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for WriteOneToClear<T>

§

impl<T> UnwindSafe for WriteOneToClear<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<O> DispatchHandler for O
where O: VmoMemoryHandler + Send + Sync + 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<H> RegistryHandler for H
where H: VmoMemoryHandler + Send + Sync + 'static,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<O> VmoMemoryHandler for O

Source§

fn load8(&self, op: VmoOpHelper<'_, u8>) -> u8

Handles an 8-bit MMIO load operation.
Source§

fn load16(&self, op: VmoOpHelper<'_, u16>) -> u16

Handles a 16-bit MMIO load operation.
Source§

fn load32(&self, op: VmoOpHelper<'_, u32>) -> u32

Handles a 32-bit MMIO load operation.
Source§

fn load64(&self, op: VmoOpHelper<'_, u64>) -> u64

Handles a 64-bit MMIO load operation.
Source§

fn store8(&self, op: VmoOpHelper<'_, u8>, value: u8)

Handles an 8-bit MMIO store operation.
Source§

fn store16(&self, op: VmoOpHelper<'_, u16>, value: u16)

Handles a 16-bit MMIO store operation.
Source§

fn store32(&self, op: VmoOpHelper<'_, u32>, value: u32)

Handles a 32-bit MMIO store operation.
Source§

fn store64(&self, op: VmoOpHelper<'_, u64>, value: u64)

Handles a 64-bit MMIO store operation.