Expand description
Io trait
The Io trait allows types to be written and read generically to byte vecs. See its documentation for usage and manual implementation.
Derive macro
The derive macro #[derive(Io)] can be used to trivially implement Io for your types.
All serialized fields must implement the Io trait for it to work.
Fields can have the #[io(ignore)] attribute added which will:
- Ignore the field when writing the full struct/enum.
- Use
Defaultfor reading as there is nothing to read from.
Std types
Currently a few types from std are supported:
- All numbers
StringBoxHashMapOptionandVecof types that implementIoDurationandSystemTime.
Traits
- A type that can be serialized to and from bytes. Should only be implemented on types that own their data, i.e.
Stringand not&str. - Extends
Readwith methods for reading numbers. (Forstd::io.) - Extends
Writewith methods for writing numbers. (Forstd::io.)
Functions
- Helper for enum Io::read implementations to use.