xcfg/
lib.rs

1//! xcfg_rs is a simple configuration file loader and saver.
2//!
3//! # Example
4//!
5//! ```rust
6//! use serde::{Deserialize, Serialize};
7//! use xcfg::XCfg;
8//! #[derive(XCfg, Serialize, Deserialize, PartialEq, Debug, Clone)]
9//! pub struct Test {
10//!     a: i32,
11//!     b: Vec<i32>,
12//!     sub: SubTest,
13//! }
14//! #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
15//! pub struct SubTest {
16//!     c: Vec<String>,
17//! }
18//! let test = Test {
19//!     a: 1,
20//!     b: vec![0, 1, 2],
21//!     sub: SubTest {
22//!         c: vec!["ab".to_string(), "cd".to_string()],
23//!     },
24//! };
25//! let path = "./test.toml";
26//! test.save(path).unwrap();
27//! assert_eq!(Test::load(path).unwrap().into_inner(), test);
28//! std::fs::remove_file(path).unwrap();
29
30mod error;
31mod format;
32pub use error::Error;
33pub use format::File;
34pub use format::Format;
35pub use format::XCfg;
36#[cfg(feature = "derive")]
37pub use xcfg_derive::XCfg;