use core::fmt::{self, Display};

/// Error from checked operations
#[derive(Debug)]
pub enum Error {
  /// An operation failed due to storage not containing enough data
  OutOfBounds,
}

impl Display for Error {
  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    use Error::*;
    match self {
      OutOfBounds => write!(f, "BitBuf: operation out of bounds"),
    }
  }
}

impl core::error::Error for Error {}
