pub struct ArrayNd<const N: usize, T> {
pub data: Vec<T>,
pub dims: [usize; N],
pub dim_strides: [usize; N],
}Fields§
§data: Vec<T>§dims: [usize; N]§dim_strides: [usize; N]Implementations§
Source§impl<const C: usize, T: Copy> ArrayNd<C, T>
impl<const C: usize, T: Copy> ArrayNd<C, T>
pub fn new<U: Copy + TryInto<usize>>(dims: [U; C], default: T) -> Self
pub fn from_slice<U: Copy + TryInto<usize>>(dims: [U; C], slice: &[T]) -> Self
pub fn resized( &self, new_dims: [usize; C], default: T, offset: Vector<C, i32>, ) -> Self
pub fn padded(&self, padding: i32, default: T) -> Self
Source§impl<const N: usize, T: Copy + PartialEq> ArrayNd<N, T>
impl<const N: usize, T: Copy + PartialEq> ArrayNd<N, T>
pub fn replace_all(&mut self, from: &T, to: &T)
Source§impl<const N: usize, T> ArrayNd<N, T>
impl<const N: usize, T> ArrayNd<N, T>
pub fn get_linear(&self, index: usize) -> &T
pub fn get_mut_linear(&mut self, index: usize) -> &mut T
pub fn set_linear(&mut self, index: usize, v: T)
pub fn get<I>(&self, p: I) -> Option<&T>where
Self: LinearIndex<I>,
pub fn get_mut<I>(&mut self, p: I) -> Option<&mut T>where
Self: LinearIndex<I>,
pub fn set<I>(&mut self, p: I, v: T) -> boolwhere
Self: LinearIndex<I>,
Source§impl<const N: usize, T> ArrayNd<N, T>
impl<const N: usize, T> ArrayNd<N, T>
pub fn find_item(&self, item: &T) -> Option<Vector<N, i32>>where
T: PartialEq,
pub fn find_last_item(&self, item: &T) -> Option<Vector<N, i32>>where
T: PartialEq,
pub fn find_all<F, I>(&self, predicate: F) -> Vec<I>
pub fn find_all_items<I>(&self, item: &T) -> Vec<I>where
T: PartialEq,
Self: LinearIndex<I>,
Source§impl<const N: usize, T: Copy> ArrayNd<N, T>
impl<const N: usize, T: Copy> ArrayNd<N, T>
pub fn draw_block(&mut self, matching: [Option<usize>; N], v: T)
Source§impl ArrayNd<2, char>
impl ArrayNd<2, char>
pub fn from_buffer<R: Read>( reader: BufReader<R>, ) -> Result<Self, CharArrayParseError>
pub fn from_read<R: Read>(reader: R) -> Result<Self, CharArrayParseError>
Trait Implementations§
Source§impl<'de, const N: usize, T> Deserialize<'de> for ArrayNd<N, T>where
T: Deserialize<'de>,
impl<'de, const N: usize, T> Deserialize<'de> for ArrayNd<N, T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize, T> LinearIndex<Vector<N, i32>> for ArrayNd<N, T>
impl<const N: usize, T> LinearIndex<Vector<N, i32>> for ArrayNd<N, T>
fn index_unchecked(&self, i: Vector<N, i32>) -> Option<usize>
fn unindex(&self, i: usize) -> Option<Vector<N, i32>>
Source§unsafe fn cardinality(&self) -> Option<usize>
unsafe fn cardinality(&self) -> Option<usize>
👎Deprecated
This is unsafe and should not be called as overflows are not checked. Uses Iterator::product Read more
fn is_in_bounds(&self, i: &Vector<N, i32>) -> bool
fn index(&self, i: I) -> Option<usize>
Source§impl<const N: usize, T> LinearIndex<Vector<N, usize>> for ArrayNd<N, T>
impl<const N: usize, T> LinearIndex<Vector<N, usize>> for ArrayNd<N, T>
fn index_unchecked(&self, i: Vector<N, usize>) -> Option<usize>
fn unindex(&self, i: usize) -> Option<Vector<N, usize>>
Source§unsafe fn cardinality(&self) -> Option<usize>
unsafe fn cardinality(&self) -> Option<usize>
👎Deprecated
This is unsafe and should not be called as overflows are not checked. Uses Iterator::product Read more
fn is_in_bounds(&self, i: &Vector<N, usize>) -> bool
fn index(&self, i: I) -> Option<usize>
Source§impl<const N: usize, T> LinearIndex<usize> for ArrayNd<N, T>
impl<const N: usize, T> LinearIndex<usize> for ArrayNd<N, T>
fn index_unchecked(&self, i: usize) -> Option<usize>
fn unindex(&self, i: usize) -> Option<usize>
Source§unsafe fn cardinality(&self) -> Option<usize>
unsafe fn cardinality(&self) -> Option<usize>
👎Deprecated
This is unsafe and should not be called as overflows are not checked. Uses Iterator::product Read more
fn is_in_bounds(&self, i: &usize) -> bool
fn index(&self, i: I) -> Option<usize>
impl<const N: usize, T: Eq> Eq for ArrayNd<N, T>
impl<const C: usize, T> IterateNeighboursContext for ArrayNd<C, T>
impl<const N: usize, T> StructuralPartialEq for ArrayNd<N, T>
Auto Trait Implementations§
impl<const N: usize, T> Freeze for ArrayNd<N, T>
impl<const N: usize, T> RefUnwindSafe for ArrayNd<N, T>where
T: RefUnwindSafe,
impl<const N: usize, T> Send for ArrayNd<N, T>where
T: Send,
impl<const N: usize, T> Sync for ArrayNd<N, T>where
T: Sync,
impl<const N: usize, T> Unpin for ArrayNd<N, T>where
T: Unpin,
impl<const N: usize, T> UnwindSafe for ArrayNd<N, 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