pub struct InOut<'inp, 'out, T> {
pub(crate) in_ptr: *const T,
pub(crate) out_ptr: *mut T,
pub(crate) _pd: PhantomData<(&'inp T, &'out mut T)>,
}
Expand description
Custom pointer type which contains one immutable (input) and one mutable (output) pointer, which are either equal or non-overlapping.
Fields§
§in_ptr: *const T
§out_ptr: *mut T
§_pd: PhantomData<(&'inp T, &'out mut T)>
Implementations§
source§impl<'inp, 'out, T> InOut<'inp, 'out, T>
impl<'inp, 'out, T> InOut<'inp, 'out, T>
sourcepub fn into_raw(self) -> (*const T, *mut T)
pub fn into_raw(self) -> (*const T, *mut T)
Convert self
to a pair of raw input and output pointers.
sourcepub unsafe fn from_raw(
in_ptr: *const T,
out_ptr: *mut T,
) -> InOut<'inp, 'out, T>
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 typeT
and must be valid for reads.out_ptr
must point to a properly initialized value of typeT
and must be valid for both reads and writes.in_ptr
andout_ptr
must be either equal or non-overlapping.- If
in_ptr
andout_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
andout_ptr
are not equal, then the memory referenced byout_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 byin_ptr
must not be mutated for the duration of lifetime'a
, except inside anUnsafeCell
.
source§impl<'inp, 'out, T, N: ArrayLength<T>> InOut<'inp, 'out, GenericArray<T, N>>
impl<'inp, 'out, T, N: ArrayLength<T>> InOut<'inp, 'out, GenericArray<T, N>>
source§impl<'inp, 'out, N: ArrayLength<u8>> InOut<'inp, 'out, GenericArray<u8, N>>
impl<'inp, 'out, N: ArrayLength<u8>> InOut<'inp, 'out, GenericArray<u8, N>>
sourcepub fn xor_in2out(&mut self, data: &GenericArray<u8, N>)
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>>
impl<'inp, 'out, N, M> InOut<'inp, 'out, GenericArray<GenericArray<u8, N>, M>>
sourcepub fn xor_in2out(&mut self, data: &GenericArray<GenericArray<u8, N>, M>)
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<'inp, 'out, T> From<(&'inp T, &'out mut T)> for InOut<'inp, 'out, T>
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
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>,
impl<'inp, 'out, T, N> TryInto<InOut<'inp, 'out, GenericArray<T, N>>> for InOutBuf<'inp, 'out, T>where
N: ArrayLength<T>,
§type Error = IntoArrayError
type Error = IntoArrayError
The type returned in the event of a conversion error.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more