Skip to main content

ArrayBuilder

Struct ArrayBuilder 

Source
#[doc(hidden)]
pub struct ArrayBuilder<T, N: ArrayLength<T>> { /* private fields */ }
Expand description

Creates an array one element at a time using a mutable iterator you can write to with ptr::write.

Increment the position while iterating to mark off created elements, which will be dropped if into_inner is not called.

Implementations§

Source§

impl<T, N: ArrayLength<T>> ArrayBuilder<T, N>

Source

#[doc(hidden)]
pub unsafe fn new() -> ArrayBuilder<T, N>

Source

#[doc(hidden)]
pub unsafe fn iter_position(&mut self) -> (IterMut<'_, T>, &mut usize)

Creates a mutable iterator for writing to the array using ptr::write.

Increment the position value given as a mutable reference as you iterate to mark how many elements have been created.

Source

#[doc(hidden)]
pub unsafe fn into_inner(self) -> GenericArray<T, N>

When done writing (assuming all elements have been written to), get the inner array.

Trait Implementations§

Source§

impl<T, N: ArrayLength<T>> Drop for ArrayBuilder<T, N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more