Struct simd_abstraction::tools::OutBuf
source · [−]pub struct OutBuf<'a, T> { /* private fields */ }
Expand description
A write-only slice of T
.
Implementations
sourceimpl<'a, T> OutBuf<'a, T>
impl<'a, T> OutBuf<'a, T>
sourcepub unsafe fn from_raw(data: *mut T, len: usize) -> OutBuf<'a, T>
pub unsafe fn from_raw(data: *mut T, len: usize) -> OutBuf<'a, T>
Forms an OutBuf<'a, T>
Safety
Behavior is undefined if any of the following conditions are violated:
-
data
must bevalid
for writes forlen * mem::size_of::<T>()
many bytes, and it must be properly aligned. This means in particular:- The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
data
must be non-null and aligned even for zero-length slices. One reason for this is that enum layout optimizations may rely on references (including slices of any length) being aligned and non-null to distinguish them from other data. You can obtain a pointer that is usable asdata
for zero-length slices usingNonNull::dangling()
.
-
data
must point tolen
consecutive places for typeT
. -
The memory referenced by the returned slice 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 total size
len * mem::size_of::<T>()
of the slice must be no larger thanisize::MAX
. See the safety documentation ofpointer::offset
.
sourcepub fn uninit(slice: &'a mut [MaybeUninit<T>]) -> OutBuf<'a, T>
pub fn uninit(slice: &'a mut [MaybeUninit<T>]) -> OutBuf<'a, T>
Forms an OutBuf
from an uninitialized slice.
sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns an unsafe mutable pointer to the buffer.
Trait Implementations
impl<T> Send for OutBuf<'_, T>where
T: Send,
impl<T> Sync for OutBuf<'_, T>where
T: Sync,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for OutBuf<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Unpin for OutBuf<'a, T>
impl<'a, T> !UnwindSafe for OutBuf<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more