#[derive(Encode)]
{
// Attributes available to this derive:
#[oxicode]
}
Available on crate feature
derive only.Expand description
Derive macro for the Encode trait
Supports structs and enums with full generic and lifetime support.
§Example
ⓘ
use oxicode::Encode;
#[derive(Encode)]
struct Point {
x: f32,
y: f32,
}
#[derive(Encode)]
enum Message {
Quit,
Move { x: i32, y: i32 },
Write(String),
}
// Skip a field during encoding
#[derive(Encode)]
struct Config {
id: u32,
#[oxicode(skip)]
cache: Vec<u8>,
}