Struct inout::InOut

source ·
pub struct InOut<'inp, 'out, T> { /* private fields */ }
Expand description

Custom pointer type which contains one immutable (input) and one mutable (output) pointer, which are either equal or non-overlapping.

Implementations§

source§

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

source

pub fn reborrow<'a>(&'a mut self) -> InOut<'a, 'a, T>

Reborrow self.

source

pub fn get_in<'a>(&'a self) -> &'a T

Get immutable reference to the input value.

source

pub fn get_out<'a>(&'a mut self) -> &'a mut T

Get mutable reference to the output value.

source

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

Convert self to a pair of raw input and output pointers.

source

pub unsafe fn from_raw( in_ptr: *const T, out_ptr: *mut T, ) -> InOut<'inp, 'out, T>

Create InOut from raw input and output pointers.

§Safety

Behavior is undefined if any of the following conditions are violated:

  • in_ptr must point to a properly initialized value of type T and must be valid for reads.
  • out_ptr must point to a properly initialized value of type T and must be valid for both reads and writes.
  • in_ptr and out_ptr must be either equal or non-overlapping.
  • If in_ptr and out_ptr are equal, then the memory referenced by them must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime ’a. Both read and write accesses are forbidden.
  • If in_ptr and out_ptr are not equal, then the memory referenced by out_ptr must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime 'a. Both read and write accesses are forbidden. The memory referenced by in_ptr must not be mutated for the duration of lifetime 'a, except inside an UnsafeCell.
source§

impl<'inp, 'out, T: Clone> InOut<'inp, 'out, T>

source

pub fn clone_in(&self) -> T

Clone input value and return it.

source§

impl<'inp, 'out, T, N: ArrayLength<T>> InOut<'inp, 'out, GenericArray<T, N>>

source

pub fn get<'a>(&'a mut self, pos: usize) -> InOut<'a, 'a, T>

Returns InOut for the given position.

§Panics

If pos greater or equal to array length.

source

pub fn into_buf(self) -> InOutBuf<'inp, 'out, T>

Convert InOut array to InOutBuf.

source§

impl<'inp, 'out, N: ArrayLength<u8>> InOut<'inp, 'out, GenericArray<u8, N>>

source

pub fn xor_in2out(&mut self, data: &GenericArray<u8, N>)

XOR data with values behind the input slice and write result to the output slice.

§Panics

If data length is not equal to the buffer length.

source§

impl<'inp, 'out, N, M> InOut<'inp, 'out, GenericArray<GenericArray<u8, N>, M>>

source

pub fn xor_in2out(&mut self, data: &GenericArray<GenericArray<u8, N>, M>)

XOR data with values behind the input slice and write result to the output slice.

§Panics

If data length is not equal to the buffer length.

Trait Implementations§

source§

impl<'a, T> From<&'a mut T> for InOut<'a, 'a, T>

source§

fn from(val: &'a mut T) -> Self

Converts to this type from the input type.
source§

impl<'inp, 'out, T> From<(&'inp T, &'out mut T)> for InOut<'inp, 'out, T>

source§

fn from((in_val, out_val): (&'inp T, &'out mut T)) -> Self

Converts to this type from the input type.
source§

impl<'inp, 'out, T, N> TryInto<InOut<'inp, 'out, GenericArray<T, N>>> for InOutBuf<'inp, 'out, T>
where N: ArrayLength<T>,

§

type Error = IntoArrayError

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

fn try_into(self) -> Result<InOut<'inp, 'out, GenericArray<T, N>>, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

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

§

impl<'inp, 'out, T> RefUnwindSafe for InOut<'inp, 'out, T>
where T: RefUnwindSafe,

§

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

§

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

§

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

§

impl<'inp, 'out, T> !UnwindSafe for InOut<'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> Same for T

§

type Output = T

Should always be Self
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.