Struct dhcproto::encoder::Encoder [−][src]
pub struct Encoder<'a> { /* fields omitted */ }
Expand description
Encoder type, holds a mut ref to a buffer that it will write data to and an offset of the next position to write
Implementations
Get a reference to the underlying buffer
write bytes to buffer Return: number of bytes written
Write const number of bytes to buffer
write a u8
write a u16
write a u32
write a u128
write a u64
write a i32
Writes bytes to buffer and pads with 0 bytes up to some fill_len
Returns Err - if bytes.len() is greater then fill_len
pub fn write_fill<T: AsRef<[u8]>>(
&mut self,
s: &Option<T>,
fill_len: usize
) -> EncodeResult<()>
pub fn write_fill<T: AsRef<[u8]>>(
&mut self,
s: &Option<T>,
fill_len: usize
) -> EncodeResult<()>
Writes value to buffer and pads with 0 bytes up to some fill_len if String is None then write fill_len 0 bytes
Returns Err - if bytes.len() is greater then fill_len