pub enum SectionType {
ScriptInfo,
Styles,
Events,
Fonts,
Graphics,
}Expand description
Section type discriminant for efficient lookup and filtering
Provides a lightweight way to identify section types without borrowing section content. Useful for filtering, routing, and type-based operations on collections of sections.
§Examples
use ass_core::parser::ast::SectionType;
let section_types = vec![SectionType::ScriptInfo, SectionType::Events];
assert!(section_types.contains(&SectionType::ScriptInfo));Variants§
ScriptInfo
[Script Info] section identifier
Styles
[V4+ Styles] section identifier
Events
[Events\] section identifier
Fonts
[Fonts\] section identifier
Graphics
[Graphics\] section identifier
Implementations§
Source§impl SectionType
impl SectionType
Sourcepub const fn header_name(self) -> &'static str
pub const fn header_name(self) -> &'static str
Get the canonical section header name
Returns the exact header name as it appears in ASS files, useful for serialization and error reporting.
§Examples
assert_eq!(SectionType::ScriptInfo.header_name(), "Script Info");
assert_eq!(SectionType::Styles.header_name(), "V4+ Styles");Sourcepub const fn is_required(self) -> bool
pub const fn is_required(self) -> bool
Check if this section type is required in valid ASS files
Returns true for sections that must be present for a valid
ASS file (Script Info and Events), false for optional sections.
Trait Implementations§
Source§impl Clone for SectionType
impl Clone for SectionType
Source§fn clone(&self) -> SectionType
fn clone(&self) -> SectionType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SectionType
impl Debug for SectionType
Source§impl Hash for SectionType
impl Hash for SectionType
Source§impl Ord for SectionType
impl Ord for SectionType
Source§fn cmp(&self, other: &SectionType) -> Ordering
fn cmp(&self, other: &SectionType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SectionType
impl PartialEq for SectionType
Source§impl PartialOrd for SectionType
impl PartialOrd for SectionType
impl Copy for SectionType
impl Eq for SectionType
impl StructuralPartialEq for SectionType
Auto Trait Implementations§
impl Freeze for SectionType
impl RefUnwindSafe for SectionType
impl Send for SectionType
impl Sync for SectionType
impl Unpin for SectionType
impl UnwindSafe for SectionType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more