✨ Examples
use *;
from_table_struct!;
from_table_struct!;
📜 License
This project is licensed under the MIT License.
use tommy::*;
#[derive(Debug)]
#[allow(unused)]
struct Cursor {
blink: bool,
blink_duration: i32,
}
from_table_struct!(Cursor {
blink: bool,
blink_duration: i32,
});
#[derive(Debug)]
#[allow(unused)]
struct Window {
title: String,
width: f64,
height: f64,
}
from_table_struct!(Window {
title: String,
width: f64,
height: f64,
});
fn main() {
let parsed_user = ParseConfig::from_file("test.toml".to_string()).unwrap();
let parsed_fabk = ParseConfig::from_file("fallback.toml".to_string()).unwrap();
let cursor_conf: Cursor = parsed_user
.table("cursor")
.or_else(|| parsed_fabk.table("cursor"))
.unwrap();
let window_conf: Window = parsed_user
.table("cursor")
.or_else(|| parsed_fabk.table("window"))
.unwrap();
println!("{:#?}", cursor_conf);
println!("{:#?}", window_conf);
}
This project is licensed under the MIT License.