About
Repository stores code for Rust library that allows to read from and write to .io file format.
Functions and plans
The current status of both serialization and deserialization:
- Primitive types
- Strings
- Arrays
- Vectors
- Hashmaps
- Structs (Named{} and tuple())
- Generics
- Tuples
- &str type
- Slices
- Option
- Result
- Combinations of all above
- Enums (Unit, Unnamed, Named)
- Unit type
()
Full list of supported types can be found in this crate's documentation.
Capabilities
- Serialization of supported types using macro to_io!() using objects reference,
- Deserialization of supported types using macro from_io!() using .io formatted String and wanted objects type,
- Renaming structs fields in and from .io formatted String using #[io_name()] helper macro using String literal as argument.
- Ordering structs fields in and from .io formatted String using #[io_order()] helper macro using either FIRST and LAST keywords or an i16 Integer.
See example below for usage of those capabilities.
Example usage
use *; // required import
// required macro derive IoDeSer, Debug and PartialEq is not required
// required macro derive, Debug and PartialEq is not required
// required macro derive, Debug and PartialEq is not required
/*
Output:
|
Address->|
|
number->|
Numeric->|
|65|
|
|
street->|Tęczowa|
city->|Warsaw|
|
+
|
number->|
String->|
|220a|
|
|
street->|Strasse|
city->|Hamburg|
|
|
Name->|John|
SecondName->|||
LastName->|Kowalski|
Age->|21|
|
Person { name: "John", second_name: None, last_name: "Kowalski", age: 21, address: [Address { city: "Warsaw", number: Numeric(65), street: "Tęczowa" }, Address { city: "Hamburg", number: String("220a"), street: "Strasse" }] }
*/