use super::{Error, Write};

pub trait RawConversion<const COUNT:usize> {
    fn convert_to_raw(&self) -> [u8; COUNT];
}

pub fn write_raw<T:RawConversion<COUNT>, const COUNT:usize>(output: &mut dyn Write, value: &T) -> Result<usize, Error> {
    Error::try_or_new(output.write(&value.convert_to_raw()))
}