1use std::path::Path;
2
3use crate::types::PresentationMetadata;
4
5pub trait SidecarFormat {
10 fn read(&self, path: &Path) -> Result<PresentationMetadata, SidecarError>;
12
13 fn write(&self, path: &Path, metadata: &PresentationMetadata) -> Result<(), SidecarError>;
15
16 fn file_extension(&self) -> &'static str;
18}
19
20#[derive(Debug, thiserror::Error)]
22pub enum SidecarError {
23 #[error("I/O error: {0}")]
25 Io(#[from] std::io::Error),
26
27 #[error("Parse error at line {line}: {message}")]
29 Parse { line: usize, message: String },
30
31 #[error("Missing required section: {0}")]
33 MissingSection(String),
34}