Skip to main content

DriverChain

Struct DriverChain 

Source
pub struct DriverChain<M, const R: usize> { /* private fields */ }
Expand description

A chain a driver owns: the regions the device reads, then the regions it writes, one descriptor each, at most R in all.

The value is a description. It owns no memory and holds no descriptor until DriverRing::publish gives it some; the bytes it names are the driver’s, in memory M reaches by the same device addresses the device will be given. Nothing is copied into a queue: a region may be a buffer that already holds a payload.

Implementations§

Source§

impl<M, const R: usize> DriverChain<M, R>

Source

pub fn new( memory: M, readable: &[Region], writable: &[Region], ) -> Result<Self, ChainShapeError>

A chain of readable regions followed by writable ones.

The shape is held to the protocol’s own rule here (validate_chain_layout), so a DriverChain that exists is one a conforming device accepts.

Source

pub fn readable(&self) -> &[Region]

The regions the device reads.

Source

pub fn writable(&self) -> &[Region]

The regions the device writes.

Source

pub const fn descriptors(&self) -> u16

Descriptors the chain takes: one a region.

Trait Implementations§

Source§

impl<M: Debug, const R: usize> Debug for DriverChain<M, R>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<M: SharedMemory + Debug, const R: usize> DriverChainBuffer for DriverChain<M, R>

Source§

type Error = MemoryFault

Concrete transport byte-access failure.
Source§

fn device_readable_len(&self) -> u64

Total bytes readable by the device.
Source§

fn device_writable_len(&self) -> u64

Total bytes writable by the device.
Source§

fn write_device_readable( &mut self, offset: u64, source: &[u8], ) -> Result<(), MemoryFault>

Write an exact logical range into the device-readable side.
Source§

fn read_device_writable( &self, offset: u64, target: &mut [u8], ) -> Result<(), MemoryFault>

Read an exact logical range from the device-writable side after completion.

Auto Trait Implementations§

§

impl<M, const R: usize> Freeze for DriverChain<M, R>
where M: Freeze,

§

impl<M, const R: usize> RefUnwindSafe for DriverChain<M, R>
where M: RefUnwindSafe,

§

impl<M, const R: usize> Send for DriverChain<M, R>
where M: Send,

§

impl<M, const R: usize> Sync for DriverChain<M, R>
where M: Sync,

§

impl<M, const R: usize> Unpin for DriverChain<M, R>
where M: Unpin,

§

impl<M, const R: usize> UnsafeUnpin for DriverChain<M, R>
where M: UnsafeUnpin,

§

impl<M, const R: usize> UnwindSafe for DriverChain<M, R>
where M: UnwindSafe,

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.