1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Get the length of constant sized arrays.
///
/// ```
/// use ergo_lib::ArrLength;
///
/// type SecretKeyBytes = [u8; 32];
///
/// assert_eq!(32, SecretKeyBytes::LEN)
/// ```
pub trait ArrLength {
    /// Length of the array
    const LEN: usize;
}

impl<T, const LENGTH: usize> ArrLength for [T; LENGTH] {
    const LEN: usize = LENGTH;
}