1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::fmt;

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Error {
    BitStreamEos,
    MissingID,
    MissingTimedID,
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::BitStreamEos => write!(f, "BitStream read past EOS"),
            Self::MissingID => write!(f, "Missing packet ID"),
            Self::MissingTimedID => write!(f, "Missing packet ID after timestamp"),
        }
    }
}

pub type Result<T> = std::result::Result<T, Error>;