#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SectionKind {
ScriptInfo,
Styles,
Events,
Fonts,
Graphics,
Unknown,
}
impl SectionKind {
#[must_use]
pub fn from_header(header: &str) -> Self {
match header.trim() {
"Script Info" => Self::ScriptInfo,
"V4+ Styles" | "V4 Styles" => Self::Styles,
"Events" => Self::Events,
"Fonts" => Self::Fonts,
"Graphics" => Self::Graphics,
_ => Self::Unknown,
}
}
#[must_use]
pub const fn expects_format(&self) -> bool {
matches!(self, Self::Styles | Self::Events)
}
#[must_use]
pub const fn is_timed(&self) -> bool {
matches!(self, Self::Events)
}
#[must_use]
pub const fn is_binary(&self) -> bool {
matches!(self, Self::Fonts | Self::Graphics)
}
}