webm_iterable/
errors.rs

1//! 
2//! Potential errors that can occur when reading or writing WebM data.
3//!
4
5use std::fmt;
6use std::error::Error;
7
8pub use ebml_iterable::error::TagIteratorError;
9pub use ebml_iterable::error::TagWriterError;
10pub use ebml_iterable::error::ToolError;
11
12///
13/// Errors that can occur when coercing WebM data into structs.
14///
15#[derive(Debug)]
16pub enum WebmCoercionError {
17
18    ///
19    /// An error when coercing raw Block data into a [`super::matroska_spec::Block`] struct.
20    ///
21    BlockCoercionError(String),
22
23    ///
24    /// An error when coercing raw SimpleBlock data into a [`super::matroska_spec::SimpleBlock`] struct.
25    ///
26    SimpleBlockCoercionError(String),
27}
28
29impl fmt::Display for WebmCoercionError {
30    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31        match self {
32            WebmCoercionError::BlockCoercionError(msg) => write!(f, "{msg}"),
33            WebmCoercionError::SimpleBlockCoercionError(msg) => write!(f, "{msg}"),
34        }
35    }
36}
37
38impl Error for WebmCoercionError {}