1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::num::NonZeroU8;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ChannelLayout {
    Mono,
    Stereo,
}

impl ChannelLayout {
    pub const fn channels(&self) -> NonZeroU8 {
        NonZeroU8::new(match self {
            Self::Mono => 1,
            Self::Stereo => 2,
        })
        .unwrap()
    }
}