use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_bytes::ByteBuf; #[derive(Serialize, Deserialize, Debug)] struct ExampleStruct { integers: Vec, floats: Vec, bools: Vec, chars: Vec, string: String, raw_string: String, bytes: Vec, byte_string: ByteBuf, raw_byte_string: ByteBuf, named_map: NamedExample, named_tuple: NamedExample, r#raw_identifiers: bool, array: Vec, tuple: Vec, map: HashMap, } #[derive(Serialize, Deserialize, Debug)] enum NamedExample { StructLike { field: usize }, TupleLike(usize), } fn main() { let example: ExampleStruct = rsn::from_str(include_str!("./alltypes.rsn")).expect("error deserializing alltypes.rsn"); println!("Loaded blog posts: {example:?}"); } #[test] fn runs() { main(); }