SrcDest

Struct SrcDest 

Source
pub struct SrcDest<'src, 'dst, T: Copy> { /* private fields */ }
Expand description

Input-output buffer for vectorized operations.

This can either be a single mutable buffer for operations that execute in-place (&mut [T]) or a pair of input and output buffers where the output is uninitialized (([T], &mut [MaybeUninit<T>])) and both buffers must have the same length.

Implementations§

Source§

impl<'dst, T: Copy> SrcDest<'_, 'dst, T>

Source

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

Return the source slice.

Source

pub fn len(&self) -> usize

Return the length of the input and output slices.

Source

pub fn is_empty(&self) -> bool

Return true if the input and output slices are empty.

Source

pub fn src_dest_ptr(&mut self) -> (*const T, *mut MaybeUninit<T>, usize)

Return source and destination slice pointers and the length.

The source and destination will either alias, or the destination will be a non-aliasing, uninitialized slice.

Source

pub unsafe fn dest_assume_init(self) -> &'dst mut [T]

Return the initialized destination slice.

§Safety

If this instance was constructed with an uninitialized destination buffer, all elements must have been initialized before this is called.

Trait Implementations§

Source§

impl<'dst, T: Copy> From<&'dst mut [T]> for SrcDest<'dst, 'dst, T>

Source§

fn from(val: &'dst mut [T]) -> Self

Converts to this type from the input type.
Source§

impl<'src, 'dst, T: Copy> From<(&'src [T], &'dst mut [MaybeUninit<T>])> for SrcDest<'src, 'dst, T>

Source§

fn from(val: (&'src [T], &'dst mut [MaybeUninit<T>])) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'src, 'dst, T> Freeze for SrcDest<'src, 'dst, T>

§

impl<'src, 'dst, T> RefUnwindSafe for SrcDest<'src, 'dst, T>
where T: RefUnwindSafe,

§

impl<'src, 'dst, T> Send for SrcDest<'src, 'dst, T>
where T: Sync + Send,

§

impl<'src, 'dst, T> Sync for SrcDest<'src, 'dst, T>
where T: Sync,

§

impl<'src, 'dst, T> Unpin for SrcDest<'src, 'dst, T>

§

impl<'src, 'dst, T> !UnwindSafe for SrcDest<'src, 'dst, 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 = 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.