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>
impl<'a, 'b> RawOffsetTraceBuilder<'a, 'b>
Sourcepub fn read8(&mut self, value: u8) -> &mut Self
pub fn read8(&mut self, value: u8) -> &mut Self
Posts an expectation for an 8-bit read from this offset, returning value.
Sourcepub fn write8(&mut self, value: u8) -> &mut Self
pub fn write8(&mut self, value: u8) -> &mut Self
Posts an expectation for an 8-bit write of value to this offset.
Sourcepub fn read16(&mut self, value: u16) -> &mut Self
pub fn read16(&mut self, value: u16) -> &mut Self
Posts an expectation for a 16-bit read from this offset, returning value.
Sourcepub fn write16(&mut self, value: u16) -> &mut Self
pub fn write16(&mut self, value: u16) -> &mut Self
Posts an expectation for a 16-bit write of value to this offset.
Sourcepub fn read32(&mut self, value: u32) -> &mut Self
pub fn read32(&mut self, value: u32) -> &mut Self
Posts an expectation for a 32-bit read from this offset, returning value.
Sourcepub fn write32(&mut self, value: u32) -> &mut Self
pub fn write32(&mut self, value: u32) -> &mut Self
Posts an expectation for a 32-bit write of value to this offset.
Sourcepub fn read64(&mut self, value: u64) -> &mut Self
pub fn read64(&mut self, value: u64) -> &mut Self
Posts an expectation for a 64-bit read from this offset, returning value.
Sourcepub fn write64(&mut self, value: u64) -> &mut Self
pub fn write64(&mut self, value: u64) -> &mut Self
Posts an expectation for a 64-bit write of value to this offset.
Sourcepub fn poll8(&mut self, values: impl IntoIterator<Item = u8>) -> &mut Self
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.
Sourcepub fn poll16(&mut self, values: impl IntoIterator<Item = u16>) -> &mut Self
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.
Sourcepub fn poll32(&mut self, values: impl IntoIterator<Item = u32>) -> &mut Self
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.
Sourcepub fn poll64(&mut self, values: impl IntoIterator<Item = u64>) -> &mut Self
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.
Sourcepub fn poll_indefinitely8(&mut self, busy_value: u8) -> &mut Self
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.
Sourcepub fn poll_indefinitely16(&mut self, busy_value: u16) -> &mut Self
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.
Sourcepub fn poll_indefinitely32(&mut self, busy_value: u32) -> &mut Self
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.
Sourcepub fn poll_indefinitely64(&mut self, busy_value: u64) -> &mut Self
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.