binroots 0.2.2

Serialize and expose data, one file per field.
Documentation
use binroots::binroots_enum;
use binroots::binroots_struct;
use binroots::save::RootType;
use binroots::save::SaveError;

#[binroots_enum]
enum Activity {
    None, // <- Automatically chosen as the default value thanks to #[binroots_enum]
    Playing(String),
}

#[binroots_struct(persistent)] // <- Gives Status and its data the ability be saved to the disk
struct Status {
    connections: usize,
    is_online: bool,
    activity: Activity,
}

fn main() -> Result<(), SaveError> {
    let mut status = Status::default();

    *status.is_online = true;
    status.save()?; // <- Saves the entire struct to the disk

    *status.activity = Activity::Playing("video gamb".into());
    status
        .activity
        .save(Status::ROOT_FOLDER, RootType::Persistent)?; // <- Only saves status.activity to the disk

    Ok(())
}