bit-string 0.4.1

A compact owned bit string type with editing, matching, and bitwise operations.
Documentation
use core::fmt;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ParseBitStringError {
    pub index: usize,
    pub byte: u8,
}

impl fmt::Display for ParseBitStringError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(
            f,
            "invalid bit character at byte index {}: {:?}",
            self.index, self.byte as char
        )
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BitStringLenMismatch {
    pub lhs_len: usize,
    pub rhs_len: usize,
}

impl fmt::Display for BitStringLenMismatch {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(
            f,
            "bit string length mismatch: lhs={}, rhs={}",
            self.lhs_len, self.rhs_len
        )
    }
}