esyn-derive

nameesyn-derive
created_at2023-05-17 10:59:09.977937
updated_at2023-12-30 08:55:55.731156
downloads1054
descriptionDe/Serialization Rust In Rust.
homepagehttps://crates.io/crates/esyn
repositoryhttps://github.com/rsuu/esyn
max_upload_size
id866852

documentation

readme

# [WIP] esyn [github](https://github.com/rsuu/esyn) [crates.io](https://crates.io/crates/esyn) [docs.rs](https://docs.rs/esyn) [build status](https://github.com/rsuu/esyn/actions?query=branch%3Amain) **De/Serialization Rust In Rust** ## Example ```rust fn main() { use esyn::*; #[derive(Debug, PartialEq, EsynDe, EsynSer)] struct Test { _string: String, _vec_u32: Vec, _opt_i64: Option, } let test = Test { _string: "hello".to_string(), _vec_u32: vec![1, 2, 4], _opt_i64: Some(-9223372036854775807), }; let config = r#" fn main() { let a = Test { _string: "hello", _vec_u32: [1, 2, 4], }; a._opt_i64 = Some(-9223372036854775807); } "#; let a = EsynBuilder::new() .set_fn("main") .set_fn("a") .get_once::(config) .unwrap(); assert_eq!(test, *a); // Serialization let code = quote! { fn main() { let a = #a; } } .into_pretty() .unwrap(); println!("{code}"); } ``` For more examples take a look on [tests](https://github.com/rsuu/esyn/tree/main/crates/esyn/tests). ## Supported Types ```rust u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize f32 f64 bool char String Vec Option Box Struct Enum Tuple ``` [see more](https://github.com/rsuu/esyn/tree/main/crates/esyn/src/ext.rs)
Commit count: 29

cargo fmt