mkv_parser_kit/error.rs
1// Copyright (C) The Strand-Braid Authors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4use std::fmt::{self, Display};
5
6pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug)]
9pub enum Error {
10 InvalidID,
11 InvalidSize,
12 BufSizeError(usize),
13 Io(std::io::Error),
14 Eof,
15}
16
17impl Display for Error {
18 fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
19 match self {
20 Error::Eof => formatter.write_str("unexpected end of input"),
21 other => {
22 write!(formatter, "{other:?}")
23 } /* and so forth */
24 }
25 }
26}
27
28impl std::error::Error for Error {}