pub struct VecIoWrapper {
    inner: Box<[u8]>,
}
Expand description

Wrapper to be used for passing a Vec in as backing memory for asynchronous operations. The wrapper owns a Vec according to the borrow checker. It is loaning this vec out to the kernel(or other modifiers) through the BackingMemory trait. This allows multiple modifiers of the array in the Vec while this struct is alive. The data in the Vec is loaned to the kernel not the data structure itself, the length, capacity, and pointer to memory cannot be modified. To ensure that those operations can be done safely, no access is allowed to the Vec’s memory starting at the time that VecIoWrapper is constructed until the time it is turned back in to a Vec using to_inner. The returned Vec is guaranteed to be valid as any combination of bits in a Vec of u8 is valid.

Fields§

§inner: Box<[u8]>

Implementations§

source§

impl VecIoWrapper

source

pub fn len(&self) -> usize

Get the length of the Vec that is wrapped.

source

pub fn is_empty(&self) -> bool

source

fn check_addrs(&self, mem_range: &MemRegion) -> Result<()>

Trait Implementations§

source§

impl BackingMemory for VecIoWrapper

source§

fn get_volatile_slice(&self, mem_range: MemRegion) -> Result<VolatileSlice<'_>>

Returns VolatileSlice pointing to the backing memory. This is most commonly unsafe. To implement this safely the implementor must guarantee that the backing memory can be modified out of band without affecting safety guarantees.
source§

impl From<Vec<u8>> for VecIoWrapper

source§

fn from(vec: Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl From<VecIoWrapper> for Vec<u8>

source§

fn from(v: VecIoWrapper) -> Vec<u8>

Converts to this type from the input type.

Auto Trait Implementations§

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.