Skip to main content

Crate easy_storage

Crate easy_storage 

Source
Expand description

§Examples

use serde::{Deserialize, Serialize};
use easy_storage::Storeable;

#[derive(Debug, Serialize, Deserialize)]
struct User {
    name: String,
    email: String,
}

impl Storeable for User {}

let user = User {
    name: "Alice".to_string(),
    email: "alice@alice.com".to_string(),
};
let save_path = std::env::current_dir().unwrap().join("test").join("user.toml");
match user.save_by_extension(&save_path, true) {
    Ok(_) => println!("success."),
    Err(e) => println!("Error: {e}"),
}
match User::load_by_extension(save_path) {
    Ok(s) => println!("{s:?}"),
    Err(e) => println!("Error: {e}"),
    }
//! ```

Enums§

Error
Format

Traits§

Storeable