dbstruct 0.6.0

Build a typed database by defining a struct
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[dbstruct::dbstruct(db=trait)]
pub struct Test {
    the_awnser: Option<u8>,
    the_question: Option<String>,
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let ds = sled::Config::default()
        .temporary(true)
        .open()?
        .open_tree("MacroInput")?;
    let db = Test::new(ds)?;
    db.the_awnser().set(&42)?;
    db.the_question().set("The Ultimate Question")?;

    Ok(())
}