orx_v/dim/index_sums/
idx_leq_d4.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use core::fmt::Debug;

/// Indices that are less than or equal to dimension 4.
#[derive(PartialEq)]
pub enum IdxLeqD4 {
    /// Index for dimension 0.
    IdxD0([usize; 0]),
    /// Index for dimension 1.
    IdxD1([usize; 1]),
    /// Index for dimension 2.
    IdxD2([usize; 2]),
    /// Index for dimension 3.
    IdxD3([usize; 3]),
    /// Index for dimension 4.
    IdxD4([usize; 4]),
}

impl Debug for IdxLeqD4 {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        match self {
            Self::IdxD0(arg0) => arg0.fmt(f),
            Self::IdxD1(arg0) => arg0.fmt(f),
            Self::IdxD2(arg0) => arg0.fmt(f),
            Self::IdxD3(arg0) => arg0.fmt(f),
            Self::IdxD4(arg0) => arg0.fmt(f),
        }
    }
}

impl From<[usize; 0]> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: [usize; 0]) -> Self {
        Self::IdxD0(value)
    }
}

impl From<[usize; 1]> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: [usize; 1]) -> Self {
        Self::IdxD1(value)
    }
}

impl From<usize> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: usize) -> Self {
        Self::IdxD1([value])
    }
}

impl From<[usize; 2]> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: [usize; 2]) -> Self {
        Self::IdxD2(value)
    }
}

impl From<[usize; 3]> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: [usize; 3]) -> Self {
        Self::IdxD3(value)
    }
}

impl From<[usize; 4]> for IdxLeqD4 {
    #[inline(always)]
    fn from(value: [usize; 4]) -> Self {
        Self::IdxD4(value)
    }
}