pub fn to_bytes(&self) -> Result<Vec<u8>, PacketError> {
        let mut bytes: Vec<u8> = Vec::new();
        let mut writer = BitWriter::endian(&mut bytes, bitstream_io::BigEndian);
        self.write_bits(&mut writer)?;

        // Add packing zeros
        writer.byte_align()?;

        Ok(bytes)
    }
/// Returns packet as byte array.
///
/// # Errors
///
/// Will return `Err` if serialization fails.
Returns packet as byte array.
Returns packet as byte array .
pub fn to_bytes(&self) -> Result<Vec<u8>, PacketError> {
        let mut bytes: Vec<u8> = Vec::new();
        let mut writer = BitWriter::endian(&mut bytes, bitstream_io::BigEndian);
        self.write_bits(&mut writer)?;
        // Add packing zeros
        writer.byte_align()?;
        Ok(bytes)
    }
pub fn to_bytes ( & self ) -> Result < Vec < u8 > , PacketError > { let mut bytes : Vec < u8 > = Vec :: new ( ) ; let mut writer = BitWriter :: endian ( & mut bytes , bitstream_io :: BigEndian ) ; self . write_bits ( & mut writer ) ? ; // Add packing zeros writer . byte_align ( ) ? ; Ok ( bytes ) }
Returns packet as byte array.
Returns packet as byte array .
&self
&self
errors
Will return `Err` if serialization fails.
Will return ` Err ` if serialization fails .