leveldb-orm-derive

Crates.ioleveldb-orm-derive
lib.rsleveldb-orm-derive
version0.1.5
sourcesrc
created_at2022-07-13 09:47:51.790006
updated_at2023-03-20 08:24:31.368687
descriptionAn ORM for leveldb
homepagehttps://github.com/dlhxzb/leveldb-orm
repositoryhttps://github.com/dlhxzb/leveldb-orm
max_upload_size
id624979
size11,073
Bo zhang (dlhxzb)

documentation

https://docs.rs/leveldb-orm-derive

README

Use LeveldbOrm + leveldb_key to auto impl trait in leveldb-orm

#[derive(LeveldbOrm)]
#[leveldb_key(executable, args)]
struct Command {
    pub executable: u8,
    pub args: Vec<String>,
    pub current_dir: Option<String>,
}

Generate code

impl<'a> leveldb_orm::KeyOrm<'a> for Command {
    type KeyType = (u8, Vec<String>);
    type KeyTypeRef = (&'a u8, &'a Vec<String>);
    #[inline]
    fn key(
        &self,
    ) -> std::result::Result<leveldb_orm::EncodedKey<Self>, Box<dyn std::error::Error>> {
        Self::encode_key((&self.executable, &self.args))
    }
}
Commit count: 11

cargo fmt