[−][src]Macro neli::serialize
This macro can be used to declaratively define serialization for a struct.
Examples
use neli::err::SerError; struct MyStruct { field_one: u16, field_two: String, field_three: Vec<u8>, } fn serialize_my_struct() -> Result<(), SerError> { let my_struct = MyStruct { field_one: 6, field_two: "Hello!".to_string(), field_three: vec![5; 5], }; let mut vec = vec![0; 2048]; neli::serialize! { vec.as_mut_slice(); my_struct.field_one; my_struct.field_two; my_struct.field_three } Ok(()) }