Skip to main content

UninitArray

Struct UninitArray 

Source
pub struct UninitArray<T: Element, D: Dimension> { /* private fields */ }
Expand description

An array whose elements have not been initialized.

The caller must call assume_init after filling all elements.

Implementations§

Source§

impl<T: Element, D: Dimension> UninitArray<T, D>

Source

pub fn shape(&self) -> &[usize]

Shape as a slice.

Source

pub fn size(&self) -> usize

Total number of elements.

Source

pub fn ndim(&self) -> usize

Number of dimensions.

Source

pub fn as_mut_ptr(&mut self) -> *mut MaybeUninit<T>

Get a mutable raw pointer to the underlying data.

Use this to fill the array element-by-element before calling assume_init().

Source

pub fn write_at(&mut self, flat_index: usize, value: T) -> FerrayResult<()>

Write a value at a flat index.

§Errors

Returns FerrayError::IndexOutOfBounds if flat_index >= size().

Source

pub unsafe fn assume_init(self) -> Array<T, D>

Convert to an initialized Array<T, D>.

§Safety

The caller must ensure that all elements have been initialized (e.g., via write_at or raw pointer writes). Reading uninitialized memory is undefined behavior.

Auto Trait Implementations§

§

impl<T, D> Freeze for UninitArray<T, D>
where D: Freeze,

§

impl<T, D> RefUnwindSafe for UninitArray<T, D>

§

impl<T, D> Send for UninitArray<T, D>

§

impl<T, D> Sync for UninitArray<T, D>

§

impl<T, D> Unpin for UninitArray<T, D>
where D: Unpin, T: Unpin,

§

impl<T, D> UnsafeUnpin for UninitArray<T, D>
where D: UnsafeUnpin,

§

impl<T, D> UnwindSafe for UninitArray<T, D>
where D: UnwindSafe, T: UnwindSafe,

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.