1 2 3 4 5 6 7 8 9 10 11 12
// Define the BitRead trait pub trait BitRead { fn read_from(data: &[u8]) -> Result<Self, ReadError> where Self: Sized; } // Define the ReadError type #[derive(Debug)] pub enum ReadError { // Different kinds of errors }