Skip to main content

mux_media/types/stream/
ty.rs

1mod is;
2mod new;
3
4use enum_map::{Enum, EnumMap};
5use std::path::Path;
6use strum_macros::{AsRefStr, EnumIter};
7
8/// A type of stream.
9#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, AsRefStr, Enum, EnumIter)]
10#[non_exhaustive]
11#[strum(serialize_all = "kebab-case")]
12pub enum StreamType {
13    Video,
14    Audio,
15    Sub,
16    Other,
17    Font,
18    Attach,
19}
20
21impl StreamType {
22    pub(crate) fn as_path(&self) -> &Path {
23        Path::new(self.as_ref())
24    }
25}
26
27impl StreamType {
28    /// Returns a new [`EnumMap<StreamType, T>`] with default values.
29    pub(crate) fn map<T>() -> EnumMap<Self, T>
30    where
31        T: Default,
32    {
33        EnumMap::default()
34    }
35}