inout

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

Source§

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

Source§

type Output = T

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