pub struct UninitVec<T> { /* private fields */ }Expand description
A safe wrapper for uninitialized Vec operations
This struct provides both safe closure-based interface and flexible pointer access for working with uninitialized memory in tensor operations.
Implementations§
Source§impl<T> UninitVec<T>
impl<T> UninitVec<T>
pub fn remaining_capacity(&self) -> usize
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice to the uninitialized memory
§Safety
The returned slice points to uninitialized memory.
Caller must ensure all elements are properly initialized before calling finalize()
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get a mutable pointer to the uninitialized memory
§Safety
The returned pointer points to uninitialized memory.
Caller must ensure proper initialization before calling finalize()
Sourcepub unsafe fn finalize(&mut self) -> Vec<T>
pub unsafe fn finalize(&mut self) -> Vec<T>
Finalize the vector, marking all elements as initialized
§Safety
Caller must ensure all elements in the capacity range are properly initialized
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for UninitVec<T>
impl<T> RefUnwindSafe for UninitVec<T>where
T: RefUnwindSafe,
impl<T> Send for UninitVec<T>where
T: Send,
impl<T> Sync for UninitVec<T>where
T: Sync,
impl<T> Unpin for UninitVec<T>where
T: Unpin,
impl<T> UnwindSafe for UninitVec<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more