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>

source

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.

source

pub fn publish_indirect( &mut self, chain: Chain, mem: &IdentityDriverMem ) -> Option<(u16, u16)>

source

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.

source

pub fn next_used(&mut self) -> Option<UsedChain>

Retrieve the next returned chain, if any.

If a chain has been returned by the device return a UsedChain, otherwise a `None.

Auto Trait Implementations§

§

impl<'a> Freeze for FakeQueue<'a>

§

impl<'a> RefUnwindSafe for FakeQueue<'a>

§

impl<'a> !Send for FakeQueue<'a>

§

impl<'a> !Sync for FakeQueue<'a>

§

impl<'a> Unpin for FakeQueue<'a>

§

impl<'a> UnwindSafe for FakeQueue<'a>

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.