Expand description
Keydata is a lib for storing data. Data is stored as key-value pairs and organized into named sections Data is stored in files created by the lib, in a hidden folder in users home directory
§Example
use std::{error::Error, fs};
fn main() -> Result<(), Box<dyn Error>> {
let mut file = keydata::KeynoteFile::new("kntest.dat")?;
file.load_data()?;
file.add_section("sectionname")?;
file.add_entry("sectionname", "somekey", "somevalue")?;
for (_, section) in file.get_sections() {
if section.data.len() != 0 {
println!("{}", section.name)
}
for (k, _) in section.data.iter() {
println!("\t{}", k);
}
}
fs::remove_file(file.filepath); // remove the test file
Ok(())
}
Structs§
- A data structure to represent the keynotes data file
- A Section to hold keynote file entries (key-value pairs)