pub struct FakeQueue<'a> { /* private fields */ }Expand description
Simulates driver side interactions of a queue for facilitating tests.
This is termed a FakeQueue as, whilst it can correctly function as a driver side queue
manager, its methods and internal book keeping are aimed at writing tests and not being
efficient.
Implementations§
Source§impl<'a> FakeQueue<'a>
impl<'a> FakeQueue<'a>
Sourcepub fn new(driver: &Driver<'a>, device: &Device<'a>) -> Option<Self>
pub fn new(driver: &Driver<'a>, device: &Device<'a>) -> Option<Self>
Construct a FakeQueue to act as driver for provided rings.
Takes a ring::Driver and ring::Device and constructs a view to the same memory to
act as the driver.
This assumes the rings have been correctly initialized, which by the virtio specification means they have been zeroed.
pub fn publish_indirect( &mut self, chain: Chain, mem: &IdentityDriverMem, ) -> Option<(u16, u16)>
Sourcepub fn publish(&mut self, chain: Chain) -> Option<(u16, u16)>
pub fn publish(&mut self, chain: Chain) -> Option<(u16, u16)>
Attempt to publish a Chain into the ring.
This returns a None if the chain is of zero length, or there are not enough available
descriptors in the ring for the chain. Otherwise it returns the current available index, and
the index of the first descriptor in the chain.