pub fn to_bytes<B, T>(bytes: B, value: &T) -> Result<(), Error> where
    T: Serialize + ?Sized,
    B: BufMut