pub struct NdArray<T, const D: usize> { /* private fields */ }Expand description
An owning, nullable, row-major array with a statically known rank.
Implementations§
Source§impl<T, const D: usize> NdArray<T, D>
impl<T, const D: usize> NdArray<T, D>
Sourcepub fn new(shape: [usize; D], values: Vec<T>) -> Result<Self>
pub fn new(shape: [usize; D], values: Vec<T>) -> Result<Self>
Construct an array with every supplied element present.
Sourcepub fn nullable(shape: [usize; D], values: Vec<Option<T>>) -> Result<Self>
pub fn nullable(shape: [usize; D], values: Vec<Option<T>>) -> Result<Self>
Construct a nullable array without changing its logical shape.
Sourcepub fn get(&self, index: [usize; D]) -> Option<Option<&T>>
pub fn get(&self, index: [usize; D]) -> Option<Option<&T>>
Read an original logical slot; the inner None denotes null.
Sourcepub fn is_valid(&self, index: [usize; D]) -> Option<bool>
pub fn is_valid(&self, index: [usize; D]) -> Option<bool>
Query the actual original validity, independently of finiteness.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = Option<&T>> + '_
pub fn iter(&self) -> impl ExactSizeIterator<Item = Option<&T>> + '_
Read every logical slot in row-major order.
Source§impl<T: NdArrayElement, const D: usize> NdArray<T, D>
impl<T: NdArrayElement, const D: usize> NdArray<T, D>
Sourcepub const fn array_type(&self) -> ArrayValueType
pub const fn array_type(&self) -> ArrayValueType
Describe the actual native element type and rank.
Trait Implementations§
Auto Trait Implementations§
impl<T, const D: usize> Forget for NdArray<T, D>
impl<T, const D: usize> Freeze for NdArray<T, D>where
*const ArcInner<[Option<T>]> is !null: Freeze,
PhantomData<ArcInner<[Option<T>]>>: Freeze,
*const ArcInner<SourceInfo> is !null: Freeze,
PhantomData<ArcInner<SourceInfo>>: Freeze,
impl<T, const D: usize> Move for NdArray<T, D>
impl<T, const D: usize> RefUnwindSafe for NdArray<T, D>
impl<T, const D: usize> Send for NdArray<T, D>
impl<T, const D: usize> Sync for NdArray<T, D>
impl<T, const D: usize> Unpin for NdArray<T, D>
impl<T, const D: usize> UnsafeUnpin for NdArray<T, D>where
*const ArcInner<[Option<T>]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[Option<T>]>>: UnsafeUnpin,
*const ArcInner<SourceInfo> is !null: UnsafeUnpin,
PhantomData<ArcInner<SourceInfo>>: UnsafeUnpin,
impl<T, const D: usize> UnwindSafe for NdArray<T, D>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.