pub use self::{axis::*, error::*, layout::Layout, rank::*, shape::Shape, stride::*};
pub(crate) mod axis;
pub(crate) mod error;
pub(crate) mod layout;
pub(crate) mod rank;
pub(crate) mod shape;
pub(crate) mod stride;
#[doc(hidden)]
pub mod dim;
pub trait IntoShape {
fn into_shape(self) -> Shape;
}
impl<S> IntoShape for S
where
S: Into<Shape>,
{
fn into_shape(self) -> Shape {
self.into()
}
}
impl<'a> IntoShape for &'a Shape {
fn into_shape(self) -> Shape {
self.clone()
}
}
pub(crate) mod prelude {
pub use super::IntoShape;
pub use super::axis::{Axis, IntoAxis};
pub use super::error::{ShapeError, ShapeResult};
pub use super::layout::Layout;
pub use super::rank::{IntoRank, Rank};
pub use super::shape::Shape;
pub use super::stride::{IntoStride, Stride};
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_shape() {
let mut shape = Shape::default();
shape.extend([1, 1, 1]);
assert_eq!(shape, Shape::new(vec![1, 1, 1]));
assert_eq!(shape.size(), 1);
assert_eq!(*shape.rank(), 3);
}
}