[WIP] esyn
Rusty Config File Parser.
Example
use ;
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
Struct
Enum
Tuple
FilterType
?
Rusty Config File Parser.
use esyn::{Esyn, EsynDe};
fn main() {
let config = r#"
fn main() {
let a = Config {
name: "hi",
window: Window {
borderless: true,
},
};
a.window.color = Color {
bg:13,
fg:12,
};
}
"#;
let esyn = Esyn::new(&config).unwrap();
let map = esyn.get::<Config>("main").unwrap();
assert_eq!(
map.get("a").unwrap(),
&Config {
name: "hi".to_string(),
window: Window {
borderless: true,
color: Color { bg: 13, fg: 12 },
},
}
);
}
#[derive(Debug, PartialEq, Default, EsynDe)]
struct Config {
name: String,
window: Window,
}
#[derive(Debug, PartialEq, Default, EsynDe)]
struct Window {
borderless: bool,
color: Color,
}
#[derive(Debug, PartialEq, Default, EsynDe)]
struct Color {
bg: u8,
fg: u8,
}
For more examples take a look on tests
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>