macro_rules! declare_type {
($ty:ident) => { ... };
($datatype:path, $ty:ident , $( flags=[$($flag:ident),*], )?
{
fn decode($ebuf:ident: [u8; $dsize:expr]) -> Result<Self, ParseError> $decode:block
fn encode($evalue:ident: $encode_type:ty) -> [u8; $esize:expr] $encode:block
$( fn to_usize($eusize:ident: usize) -> $eusize_self:ty $to_usize:block )?
$( fn from_usize($eusize2:ident: $eusize_self2:ty) -> usize $from_usize:block )?
}
) => { ... };
($datatype:path, $ty:ident<$lt:lifetime>, builder: $builder:ty, $( flags=[$($flag:ident),*], )?
{
fn decode($dbuf:ident: &mut &[u8]) -> Result<Self, ParseError> $decode:block
fn encode($ebuf:ident: &mut BufWriter, $evalue:ident: $encode_type:ty) $encode:block
}) => { ... };
}
Expand description
This macro is used to declare serialization traits for a type.