rusty_perm/
size.rs

1//! Permutation size markers.
2
3#[cfg(feature = "std")]
4pub use with_std::*;
5pub use without_std::*;
6
7/// The permutation size marker trait.
8pub trait PermSize
9where
10    Self::Container: AsRef<[usize]>,
11{
12    type Container;
13}
14
15mod without_std {
16    use super::*;
17
18    impl<const SIZE: usize> PermSize for Static<SIZE> {
19        type Container = [usize; SIZE];
20    }
21
22    /// The static size marker type.
23    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24    pub struct Static<const SIZE: usize>;
25}
26
27#[cfg(feature = "std")]
28mod with_std {
29    use super::*;
30
31    /// The dynamic size marker type.
32    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
33    pub struct Dynamic;
34
35    impl PermSize for Dynamic {
36        type Container = Vec<usize>;
37    }
38}