esyn 0.6.0

Rusty Config File Parser.
Documentation

[WIP] esyn

Rusty Config File Parser.

Example

fn main() {
    use esyn::{Esyn, EsynDe};

    #[derive(Debug, PartialEq, EsynDe)]
    struct Test {
        _string: String,
        _vec_u32: Vec<u32>,
        _opt_i64: Option<i64>,
    }

    let config = r#"
fn main() {
    let a = Test {
        _string: "hello",
        _vec_u32: [1, 2, 4],
    };
    a._opt_i64 = Some(-9223372036854775807i64);
}
"#;

    let ast = Esyn::ast(config).unwrap();
    let esyn = Esyn::new(&ast).unwrap();

    let a = &esyn.get::<Test>("main", "a").unwrap();

    assert_eq!(
        a,
        &Test {
            _string: format!("hello"),
            _vec_u32: vec![1, 2, 4],
            _opt_i64: Some(-9223372036854775807i64)
        }
    );
}

For more examples take a look on tests

Supported Types

u8 u16 u32 u64 u128 usize
i8 i16 i32 i64 i128 isize
f32 f64
bool char String

Vec<T>
Option<T>
HashMap<K, V>
BTreeMap<K, V>

Option<IpAddr>
Option<Ipv4Addr>
Option<Ipv6Addr>

Struct
Enum
Tuple

fast_image_resize::FilterType

?Box<T>

TODO

to_string() Debug -> ? Default -> ?