concision_core/traits/
convert.rs

1/*
2    appellation: convert <module>
3    authors: @FL03
4*/
5use ndarray::Axis;
6
7/// The [`IntoAxis`] trait is used to define a conversion routine that takes a type and wraps
8/// it in an [`Axis`] type.
9pub trait IntoAxis {
10    fn into_axis(self) -> Axis;
11}
12
13/*
14 ************* Implementations *************
15*/
16
17impl<S> IntoAxis for S
18where
19    S: AsRef<usize>,
20{
21    fn into_axis(self) -> Axis {
22        Axis(*self.as_ref())
23    }
24}