embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

InOutBuf

Struct InOutBuf 

Source
pub struct InOutBuf<'inp, 'out, T> { /* private fields */ }
Expand description

A lightweight I/O buffer abstraction without depending on the RustCrypto inout crate.

Implementations§

Source§

impl<'inp, 'out, T> InOutBuf<'inp, 'out, T>

Source

pub fn new( in_buf: &'inp [T], out_buf: &'out mut [T], ) -> Result<Self, NotEqualError>

Create an in/out buffer from separate input and output slices.

Source

pub unsafe fn from_raw(in_ptr: *const T, out_ptr: *mut T, len: usize) -> Self

Construct from raw pointers.

Source

pub fn get_in(&self) -> &[T]

Access the input side without copying.

Source

pub fn get_out(&mut self) -> &mut [T]

Access the output side without copying.

Source

pub fn into_out(self) -> &'out mut [T]

Return the output slice while preserving the caller’s write access.

Source

pub fn into_out_with_copied_in(self) -> &'out mut [T]
where T: Copy,

Return the output slice, copying input into output when the regions differ.

Source

pub fn into_raw(self) -> (*const T, *mut T)

Consume the buffer and return the raw pointers.

Source

pub fn len(&self) -> usize

Length of the buffer.

Source

pub fn is_empty(&self) -> bool

Whether the buffer is empty.

Trait Implementations§

Source§

impl<'a, T> From<&'a mut [T]> for InOutBuf<'a, 'a, T>

Source§

fn from(buf: &'a mut [T]) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'inp, 'out, T> !Send for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> !Sync for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> !UnwindSafe for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> Freeze for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> RefUnwindSafe for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> Unpin for InOutBuf<'inp, 'out, T>

§

impl<'inp, 'out, T> UnsafeUnpin for InOutBuf<'inp, 'out, T>

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