Crate orio

source ·
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:

  1. Ignore the field when writing the full struct/enum.
  2. Use Default for reading as there is nothing to read from.

Std types

Currently a few types from std are supported:

  • All numbers
  • String
  • Box HashMap Option and Vec of types that implement Io
  • Duration and SystemTime.

Traits

  • A type that can be serialized to and from bytes. Should only be implemented on types that own their data, i.e. String and not &str.
  • Extends Read with methods for reading numbers. (For std::io.)
  • Extends Write with methods for writing numbers. (For std::io.)

Functions

Type Aliases

Derive Macros