Trait AttributeWriteExt

Source
pub trait AttributeWriteExt: AttributeWrite {
    // Required methods
    fn write_header_unchecked(&self, dest: &mut [u8]) -> usize;
    fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>;
    fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>;
}
Expand description

Automatically implemented trait providing helper functionality for writing an Attribute to a sequence of bytes.

Required Methods§

Source

fn write_header_unchecked(&self, dest: &mut [u8]) -> usize

Write the 4 byte attribute header into the provided destination buffer returning the number of bytes written.

Panics if the destination cannot hold at least 4 bytes of data.

Source

fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>

Write the 4 byte attribute header into the provided destination buffer returning the number of bytes written, or an error.

Source

fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>

Write this attribute into the provided destination buffer returning the number of bytes written, or an error.

Implementors§