pub trait PacketField: Sized {
// Required methods
fn write_to(&self, buf: &mut Vec<u8>);
fn read_from(buf: &[u8], pos: &mut usize) -> Option<Self>;
}Expand description
Encode/decode a single field to/from a byte buffer.
Implemented for the types supported by packet!:
bool, i32, i64, u32, u64, f32, f64, String, Vec<u8>.
Required Methods§
fn write_to(&self, buf: &mut Vec<u8>)
fn read_from(buf: &[u8], pos: &mut usize) -> Option<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".