pub fn to_bytes_writer<T, W>(msg: &mut T, w: &mut W) -> Result<(), EncodeError>where
    T: EncodeMessage,
    W: BytesWrite,