Skip to main content

impl_letype_num

Macro impl_letype_num 

Source
macro_rules! impl_letype_num {
    ($t:ty, $w:expr) => { ... };
}
Expand description

Implement the [LeBytes] trait for a numeric type with a fixed byte width.

This is used to unify little-endian serialization for primitive types like u16, u32, f32, etc.

$t: concrete numeric type (e.g. u16, i32, f32) $w: width in bytes (size_of::<$t>())

ยงExample

impl_letype_num!(u32, 4);
impl_letype_num!(f32, 4);