collum 0.1.0

A crate for cleanly describing and parsing bit-wide data structures
Documentation
use core::ops::Deref;

/// A type with big-endian encoding.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct Big<T>(pub T);

/// A type with little-endian encoding.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct Little<T>(pub T);

impl<T> Deref for Big<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl<T> Deref for Little<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl<T> crate::Sized for Big<T>
where
    T: crate::Sized,
{
    fn bits() -> usize {
        T::bits()
    }
}

impl<T> crate::Sized for Little<T>
where
    T: crate::Sized,
{
    fn bits() -> usize {
        T::bits()
    }
}