pub struct Shape { /* private fields */ }
Expand description
A structure representing the shape of a Matrix<T>
.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn nrows(&self) -> usize
pub fn nrows(&self) -> usize
Returns the number of rows of the shape.
§Examples
use matreex::Shape;
let shape = Shape::new(2, 3);
assert_eq!(shape.nrows(), 2);
Sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the shape.
§Examples
use matreex::Shape;
let shape = Shape::new(2, 3);
assert_eq!(shape.ncols(), 3);
Sourcepub fn size(&self) -> Result<usize>
pub fn size(&self) -> Result<usize>
Returns the size of the shape.
§Errors
Error::SizeOverflow
if size exceedsusize::MAX
.
§Examples
use matreex::{Error, Shape};
let shape = Shape::new(2, 3);
assert_eq!(shape.size(), Ok(6));
let shape = Shape::new(2, usize::MAX);
assert_eq!(shape.size(), Err(Error::SizeOverflow));
Trait Implementations§
impl Copy for Shape
impl Eq for Shape
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more