1use core::fmt::{self, Display};
2
3#[derive(Debug, PartialEq)]
5pub enum Error {
6 Unaligned,
8 OutOfBounds,
10 InvalidBitCount,
12}
13
14impl Display for Error {
15 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16 use Error::*;
17 match self {
18 OutOfBounds => write!(f, "BitBuf: operation out of bounds"),
19 Unaligned => write!(f, "BitBuf: aligned operation on unaligned cursor"),
20 InvalidBitCount => write!(f, "BitBuf: requested bit count exceeds type width"),
21 }
22 }
23}
24
25impl core::error::Error for Error {}