pub struct Array2<T> { /* private fields */ }Expand description
A small, row-major, contiguous 2-D array used by the computational core.
Implementations§
Source§impl<T> Array2<T>
impl<T> Array2<T>
pub fn from_vec(shape: (usize, usize), data: Vec<T>) -> Result<Self>
pub fn shape(&self) -> (usize, usize)
pub fn height(&self) -> usize
pub fn width(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn as_slice(&self) -> &[T]
pub fn as_mut_slice(&mut self) -> &mut [T]
pub fn into_vec(self) -> Vec<T>
pub fn get(&self, row: usize, col: usize) -> Option<&T>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
pub fn map<U>(&self, function: impl FnMut(&T) -> U) -> Array2<U>
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Array2<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Array2<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
impl<T> StructuralPartialEq for Array2<T>
Auto Trait Implementations§
impl<T> Freeze for Array2<T>
impl<T> RefUnwindSafe for Array2<T>where
T: RefUnwindSafe,
impl<T> Send for Array2<T>where
T: Send,
impl<T> Sync for Array2<T>where
T: Sync,
impl<T> Unpin for Array2<T>where
T: Unpin,
impl<T> UnsafeUnpin for Array2<T>
impl<T> UnwindSafe for Array2<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