Skip to main content

RawOffsetTraceBuilder

Struct RawOffsetTraceBuilder 

Source
pub struct RawOffsetTraceBuilder<'a, 'b> { /* private fields */ }
Expand description

Builder for recording expected MMIO accesses at a fixed raw byte offset.

Returned by ExpectedTraceBuilder::at.

Operations on RawOffsetTraceBuilder return &mut Self, allowing read-modify-write sequences at the same offset to be chained:

let mock_builder = MockMmioRegionBuilder::new(0x1000);
mock_builder.expect(|t| {
    t.at(0x08).read32(0x0000_0001).write32(0x0000_0003);
});
let mut mmio = mock_builder.build();
assert_eq!(mmio.load32(0x08), 0x0000_0001);
mmio.store32(0x08, 0x0000_0003);

Implementations§

Source§

impl<'a, 'b> RawOffsetTraceBuilder<'a, 'b>

Source

pub fn read8(&mut self, value: u8) -> &mut Self

Posts an expectation for an 8-bit read from this offset, returning value.

Source

pub fn write8(&mut self, value: u8) -> &mut Self

Posts an expectation for an 8-bit write of value to this offset.

Source

pub fn read16(&mut self, value: u16) -> &mut Self

Posts an expectation for a 16-bit read from this offset, returning value.

Source

pub fn write16(&mut self, value: u16) -> &mut Self

Posts an expectation for a 16-bit write of value to this offset.

Source

pub fn read32(&mut self, value: u32) -> &mut Self

Posts an expectation for a 32-bit read from this offset, returning value.

Source

pub fn write32(&mut self, value: u32) -> &mut Self

Posts an expectation for a 32-bit write of value to this offset.

Source

pub fn read64(&mut self, value: u64) -> &mut Self

Posts an expectation for a 64-bit read from this offset, returning value.

Source

pub fn write64(&mut self, value: u64) -> &mut Self

Posts an expectation for a 64-bit write of value to this offset.

Source

pub fn poll8(&mut self, values: impl IntoIterator<Item = u8>) -> &mut Self

Posts an expectation for successive 8-bit reads from this offset returning values.

See ExpectedTraceBuilder::poll for the polling semantics.

§Panics

Panics if values is empty.

Source

pub fn poll16(&mut self, values: impl IntoIterator<Item = u16>) -> &mut Self

Posts an expectation for successive 16-bit reads from this offset returning values.

See ExpectedTraceBuilder::poll for the polling semantics.

§Panics

Panics if values is empty.

Source

pub fn poll32(&mut self, values: impl IntoIterator<Item = u32>) -> &mut Self

Posts an expectation for successive 32-bit reads from this offset returning values.

See ExpectedTraceBuilder::poll for the polling semantics.

§Panics

Panics if values is empty.

Source

pub fn poll64(&mut self, values: impl IntoIterator<Item = u64>) -> &mut Self

Posts an expectation for successive 64-bit reads from this offset returning values.

See ExpectedTraceBuilder::poll for the polling semantics.

§Panics

Panics if values is empty.

Source

pub fn poll_indefinitely8(&mut self, busy_value: u8) -> &mut Self

Posts an expectation for indefinite 8-bit reads from this offset returning busy_value.

See ExpectedTraceBuilder::poll_indefinitely for the polling semantics.

Source

pub fn poll_indefinitely16(&mut self, busy_value: u16) -> &mut Self

Posts an expectation for indefinite 16-bit reads from this offset returning busy_value.

See ExpectedTraceBuilder::poll_indefinitely for the polling semantics.

Source

pub fn poll_indefinitely32(&mut self, busy_value: u32) -> &mut Self

Posts an expectation for indefinite 32-bit reads from this offset returning busy_value.

See ExpectedTraceBuilder::poll_indefinitely for the polling semantics.

Source

pub fn poll_indefinitely64(&mut self, busy_value: u64) -> &mut Self

Posts an expectation for indefinite 64-bit reads from this offset returning busy_value.

See ExpectedTraceBuilder::poll_indefinitely for the polling semantics.

Trait Implementations§

Source§

impl<'a, 'b> Debug for RawOffsetTraceBuilder<'a, 'b>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b> !RefUnwindSafe for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> Freeze for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> Send for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> Sync for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> Unpin for RawOffsetTraceBuilder<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for RawOffsetTraceBuilder<'a, 'b>

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