Skip to main content

ass_editor/formats/srt/
format.rs

1//! `SrtFormat` handler definition and trait dispatch wiring.
2//!
3//! Defines the [`SrtFormat`] type, its constructor, and the [`Format`]
4//! dispatch implementation. Import and export behaviour live in sibling
5//! modules.
6
7use crate::formats::{Format, FormatExporter, FormatImporter, FormatInfo};
8
9/// SRT format handler with style preservation
10#[derive(Debug)]
11pub struct SrtFormat {
12    pub(super) info: FormatInfo,
13}
14
15impl SrtFormat {
16    /// Create a new SRT format handler
17    pub fn new() -> Self {
18        Self {
19            info: FormatInfo {
20                name: "SRT".to_string(),
21                extensions: vec!["srt".to_string()],
22                mime_type: "text/srt".to_string(),
23                description: "SubRip subtitle format with style preservation".to_string(),
24                supports_styling: true,
25                supports_positioning: false,
26            },
27        }
28    }
29}
30
31impl Default for SrtFormat {
32    fn default() -> Self {
33        Self::new()
34    }
35}
36
37impl Format for SrtFormat {
38    fn as_importer(&self) -> &dyn FormatImporter {
39        self
40    }
41
42    fn as_exporter(&self) -> &dyn FormatExporter {
43        self
44    }
45}