1pub use self::{axis::*, error::*, layout::Layout, rank::*, shape::Shape, stride::*};
11
12pub(crate) mod axis;
13pub(crate) mod error;
14pub(crate) mod layout;
15pub(crate) mod rank;
16pub(crate) mod shape;
17pub(crate) mod stride;
18
19#[doc(hidden)]
20pub mod dim;
21
22pub trait IntoShape {
23 fn into_shape(self) -> Shape;
24}
25
26impl<S> IntoShape for S
27where
28 S: Into<Shape>,
29{
30 fn into_shape(self) -> Shape {
31 self.into()
32 }
33}
34
35impl<'a> IntoShape for &'a Shape {
36 fn into_shape(self) -> Shape {
37 self.clone()
38 }
39}
40
41pub(crate) mod prelude {
42 pub use super::IntoShape;
43
44 pub use super::axis::{Axis, IntoAxis};
45 pub use super::error::{ShapeError, ShapeResult};
46 pub use super::layout::Layout;
47 pub use super::rank::{IntoRank, Rank};
48 pub use super::shape::Shape;
49 pub use super::stride::{IntoStride, Stride};
50}
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn test_shape() {
58 let mut shape = Shape::default();
59 shape.extend([1, 1, 1]);
60 assert_eq!(shape, Shape::new(vec![1, 1, 1]));
61 assert_eq!(shape.size(), 1);
62 assert_eq!(*shape.rank(), 3);
63 }
64}