config/config.rs
1use apputils::config::Cfg;
2use apputils::{Colors, paintln};
3use std::io;
4
5const APP: &str = "apputils";
6const FILE: &str = "test.txt";
7const PAYLOAD: &str = "Hello, Wörld!";
8
9fn main() -> io::Result<()> {
10 paintln!(Colors::Blue, "Saving test file...");
11 Cfg::save(APP, FILE, PAYLOAD)?;
12
13 paintln!(Colors::Cyan, "Reading test file...");
14 let text = Cfg::read(APP, FILE)?;
15
16 println!("Test file: {text}");
17 assert_eq!(text, PAYLOAD.to_owned());
18 Ok(())
19}