[][src]Struct building_blocks::prelude::ArrayN

pub struct ArrayN<N, T> { /* fields omitted */ }

A map from lattice location PointN<N> to data T, stored as a flat array on the heap.

Implementations

impl<N, T> ArrayN<N, T>[src]

pub fn reset_values(&mut self, value: T) where
    T: Clone
[src]

Set all points to the same value.

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

Returns the entire slice of values.

pub fn into_parts(self) -> (ExtentN<N>, Vec<T>)[src]

Moves the raw extent and values Vec out of self.

pub fn extent(&self) -> &ExtentN<N>[src]

impl<N, T> ArrayN<N, T> where
    ExtentN<N>: IntegerExtent<N>, 
[src]

pub fn new(extent: ExtentN<N>, values: Vec<T>) -> ArrayN<N, T>[src]

Create a new ArrayN directly from the extent and values. This asserts that the number of points in the extent matches the length of the values Vec.

pub unsafe fn maybe_uninit(extent: ExtentN<N>) -> ArrayN<N, MaybeUninit<T>>[src]

Creates an uninitialized map, mainly for performance.

Safety

Call assume_init after manually initializing all of the values.

pub fn fill(extent: ExtentN<N>, value: T) -> ArrayN<N, T> where
    T: Clone
[src]

Creates a map that fills the entire extent with the same value.

pub fn set_minimum(&mut self, p: PointN<N>)[src]

Sets the extent minimum to p.

impl<N, T> ArrayN<N, T> where
    PointN<N>: Point
[src]

pub fn contains(&self, p: &PointN<N>) -> bool[src]

Returns true iff this map contains point p.

impl<N, T> ArrayN<N, T> where
    PointN<N>: Point,
    ExtentN<N>: IntegerExtent<N>, 
[src]

pub fn fill_with(
    extent: ExtentN<N>,
    filler: impl FnMut(&PointN<N>) -> T
) -> ArrayN<N, T> where
    ArrayN<N, MaybeUninit<T>>: for<'r> GetMut<&'r PointN<N>>,
    <ArrayN<N, MaybeUninit<T>> as GetMut<&'r PointN<N>>>::Data == MaybeUninit<T>, 
[src]

Create a new array for extent where each point's value is determined by the filler function.

pub fn translate(&mut self, p: PointN<N>)[src]

Adds p to the extent minimum.

impl<N, T> ArrayN<N, T> where
    ArrayN<N, T>: ForEachMut<N, Stride>,
    ExtentN<N>: IntegerExtent<N>,
    ExtentN<N>: PartialEq<ExtentN<N>>,
    <ArrayN<N, T> as ForEachMut<N, Stride>>::Data == T, 
[src]

pub fn fill_extent(&mut self, extent: &ExtentN<N>, value: T) where
    T: Clone
[src]

Fill the entire extent with the same value.

impl<N, T> ArrayN<N, MaybeUninit<T>> where
    PointN<N>: Point,
    ExtentN<N>: IntegerExtent<N>, 
[src]

pub unsafe fn assume_init(self) -> ArrayN<N, T>[src]

Transmutes the map values from MaybeUninit<T> to T after manual initialization. The implementation just reconstructs the internal Vec after transmuting the data pointer, so the overhead is minimal.

Safety

All elements of the map must be initialized.

Trait Implementations

impl<N, T> Array<N> for ArrayN<N, T> where
    N: ArrayIndexer<N>, 
[src]

type Indexer = N

impl<N, T> Clone for ArrayN<N, T> where
    N: Clone,
    T: Clone
[src]

impl<N, T> Compressible<FastLz4> for ArrayN<N, T> where
    T: Copy,
    ExtentN<N>: IntegerExtent<N>, 
[src]

impl<N, T> Debug for ArrayN<N, T> where
    N: Debug,
    T: Debug
[src]

impl<'de, N, T> Deserialize<'de> for ArrayN<N, T> where
    N: Deserialize<'de>,
    T: Deserialize<'de>, 
[src]

impl<N, T> Eq for ArrayN<N, T> where
    N: Eq,
    T: Eq
[src]

impl<N, T> ForEach<N, (PointN<N>, Stride)> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: Get<Stride>,
    ArrayN<N, T>: GetUnchecked<Stride>,
    <ArrayN<N, T> as Get<Stride>>::Data == T,
    <ArrayN<N, T> as GetUnchecked<Stride>>::Data == T, 
[src]

type Data = T

impl<N, T> ForEach<N, PointN<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: Get<Stride>,
    ArrayN<N, T>: GetUnchecked<Stride>,
    <ArrayN<N, T> as Get<Stride>>::Data == T,
    <ArrayN<N, T> as GetUnchecked<Stride>>::Data == T, 
[src]

type Data = T

impl<N, T> ForEach<N, Stride> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: Get<Stride>,
    ArrayN<N, T>: GetUnchecked<Stride>,
    <ArrayN<N, T> as Get<Stride>>::Data == T,
    <ArrayN<N, T> as GetUnchecked<Stride>>::Data == T, 
[src]

type Data = T

impl<N, T> ForEachMut<N, (PointN<N>, Stride)> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetMut<Stride>,
    ArrayN<N, T>: GetUncheckedMut<Stride>,
    ExtentN<N>: Copy,
    <ArrayN<N, T> as GetMut<Stride>>::Data == T,
    <ArrayN<N, T> as GetUncheckedMut<Stride>>::Data == T, 
[src]

type Data = T

impl<N, T> ForEachMut<N, PointN<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetMut<Stride>,
    ArrayN<N, T>: GetUncheckedMut<Stride>,
    ExtentN<N>: Copy,
    <ArrayN<N, T> as GetMut<Stride>>::Data == T,
    <ArrayN<N, T> as GetUncheckedMut<Stride>>::Data == T, 
[src]

type Data = T

impl<N, T> ForEachMut<N, Stride> for ArrayN<N, T> where
    ArrayN<N, T>: Sized,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetMut<Stride>,
    ArrayN<N, T>: GetUncheckedMut<Stride>,
    ExtentN<N>: Copy,
    <ArrayN<N, T> as GetMut<Stride>>::Data == T,
    <ArrayN<N, T> as GetUncheckedMut<Stride>>::Data == T, 
[src]

type Data = T

impl<'_, N, T> Get<&'_ Local<N>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: Get<Stride>,
    <ArrayN<N, T> as Get<Stride>>::Data == T, 
[src]

type Data = T

impl<'_, N, T> Get<&'_ PointN<N>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: for<'r> Get<&'r Local<N>>,
    PointN<N>: Point,
    <ArrayN<N, T> as Get<&'r Local<N>>>::Data == T, 
[src]

type Data = T

impl<N, T> Get<Stride> for ArrayN<N, T> where
    T: Clone
[src]

type Data = T

impl<'_, N, T> GetMut<&'_ Local<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetMut<Stride>,
    <ArrayN<N, T> as GetMut<Stride>>::Data == T, 
[src]

type Data = T

impl<'_, N, T> GetMut<&'_ PointN<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: for<'r> GetMut<&'r Local<N>>,
    PointN<N>: Point,
    <ArrayN<N, T> as GetMut<&'r Local<N>>>::Data == T, 
[src]

type Data = T

impl<N, T> GetMut<Stride> for ArrayN<N, T>[src]

type Data = T

impl<'_, N, T> GetUnchecked<&'_ Local<N>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetUnchecked<Stride>,
    <ArrayN<N, T> as GetUnchecked<Stride>>::Data == T, 
[src]

type Data = T

impl<'_, N, T> GetUnchecked<&'_ PointN<N>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: for<'r> GetUnchecked<&'r Local<N>>,
    PointN<N>: Point,
    <ArrayN<N, T> as GetUnchecked<&'r Local<N>>>::Data == T, 
[src]

type Data = T

impl<N, T> GetUnchecked<Stride> for ArrayN<N, T> where
    T: Clone
[src]

type Data = T

impl<'_, N, T> GetUncheckedMut<&'_ Local<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetUncheckedMut<Stride>,
    <ArrayN<N, T> as GetUncheckedMut<Stride>>::Data == T, 
[src]

type Data = T

impl<'_, N, T> GetUncheckedMut<&'_ PointN<N>> for ArrayN<N, T> where
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: for<'r> GetUncheckedMut<&'r Local<N>>,
    PointN<N>: Point,
    <ArrayN<N, T> as GetUncheckedMut<&'r Local<N>>>::Data == T, 
[src]

type Data = T

impl<N, T> GetUncheckedMut<Stride> for ArrayN<N, T>[src]

type Data = T

impl<N, T> PartialEq<ArrayN<N, T>> for ArrayN<N, T> where
    N: PartialEq<N>,
    T: PartialEq<T>, 
[src]

impl<'a, N, T> ReadExtent<'a, N> for ArrayN<N, T> where
    N: 'a,
    T: 'a,
    PointN<N>: IntegerPoint
[src]

type Src = ArrayCopySrc<&'a ArrayN<N, T>>

type SrcIter = Once<(ExtentN<N>, <ArrayN<N, T> as ReadExtent<'a, N>>::Src)>

impl<N, T> Serialize for ArrayN<N, T> where
    N: Serialize,
    T: Serialize
[src]

impl<N, T> StructuralEq for ArrayN<N, T>[src]

impl<N, T> StructuralPartialEq for ArrayN<N, T>[src]

impl<'a, N, T> WriteExtent<N, ArrayCopySrc<&'a ArrayN<N, T>>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: GetUncheckedRelease<Stride, T>,
    PointN<N>: IntegerPoint,
    ExtentN<N>: Copy
[src]

impl<'a, N, T, M, F> WriteExtent<N, ArrayCopySrc<TransformMap<'a, M, F>>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    TransformMap<'a, M, F>: Array<N>,
    TransformMap<'a, M, F>: GetUncheckedRelease<Stride, T>,
    PointN<N>: IntegerPoint,
    ExtentN<N>: Copy
[src]

impl<M, N, T> WriteExtent<N, Either<ArrayCopySrc<M>, AmbientExtent<N, T>>> for ArrayN<N, T> where
    T: Clone,
    ArrayN<N, T>: Array<N>,
    ArrayN<N, T>: WriteExtent<N, ArrayCopySrc<M>>,
    ExtentN<N>: Copy,
    ExtentN<N>: IntegerExtent<N>,
    ExtentN<N>: PartialEq<ExtentN<N>>, 
[src]

impl<'a, N, F, T> WriteExtent<N, F> for ArrayN<N, T> where
    F: Fn(&PointN<N>) -> T,
    T: 'a + Clone,
    PointN<N>: IntegerPoint,
    ExtentN<N>: IntegerExtent<N>,
    ArrayN<N, T>: ForEachMut<N, PointN<N>>,
    <ArrayN<N, T> as ForEachMut<N, PointN<N>>>::Data == T, 
[src]

Auto Trait Implementations

impl<N, T> RefUnwindSafe for ArrayN<N, T> where
    N: RefUnwindSafe,
    T: RefUnwindSafe

impl<N, T> Send for ArrayN<N, T> where
    N: Send,
    T: Send

impl<N, T> Sync for ArrayN<N, T> where
    N: Sync,
    T: Sync

impl<N, T> Unpin for ArrayN<N, T> where
    N: Unpin,
    T: Unpin

impl<N, T> UnwindSafe for ArrayN<N, T> where
    N: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Compressible<BincodeLz4> for T where
    T: DeserializeOwned + Serialize

type Compressed = BincodeLz4Compressed<T>

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<'a, F, N, T> ForEach<N, PointN<N>> for F where
    F: Fn(&PointN<N>) -> T,
    PointN<N>: Copy,
    ExtentN<N>: IntegerExtent<N>, 
[src]

type Data = T

impl<T> From<T> for T[src]

impl<F, T, Coord> Get<Coord> for F where
    F: Fn(Coord) -> T, 
[src]

type Data = T

impl<M, L, T> GetUncheckedMutRelease<L, T> for M where
    M: GetMut<L, Data = T> + GetUncheckedMut<L, Data = T>, 
[src]

impl<M, L, T> GetUncheckedRelease<L, T> for M where
    M: Get<L, Data = T> + GetUnchecked<L, Data = T>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<'a, F, N, T> ReadExtent<'a, N> for F where
    F: 'a + Fn(&PointN<N>) -> T,
    ExtentN<N>: Copy,
    PointN<N>: Point
[src]

type Src = &'a F

type SrcIter = Once<(ExtentN<N>, <F as ReadExtent<'a, N>>::Src)>

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,