virtio_device::fake_queue

Struct FakeQueue

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

Source§

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

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.