#sled #serde #database

sled-extensions

Wrappers around the Sled embedded database to permit storing structured data

5 releases

0.2.0 Oct 16, 2019
0.1.3 Sep 17, 2019
0.1.2 Sep 17, 2019
0.1.1 Sep 16, 2019
0.1.0 Sep 16, 2019

#1084 in Encoding

Download history 57/week @ 2023-11-18 84/week @ 2023-11-25 26/week @ 2023-12-02 15/week @ 2023-12-09 21/week @ 2023-12-16 18/week @ 2023-12-23 2/week @ 2023-12-30 15/week @ 2024-01-06 18/week @ 2024-01-13 13/week @ 2024-01-20 3/week @ 2024-01-27 10/week @ 2024-02-03 32/week @ 2024-02-10 32/week @ 2024-02-17 35/week @ 2024-02-24 27/week @ 2024-03-02

129 downloads per month
Used in 2 crates

Custom license

61KB
1K SLoC

Sled Extensions

Wrappers around the Sled embedded database to permit storing structured data

Using Sled Extensions is much like using Sled. The Tree API mirrors Sled's directly, and the [Db] type is extended through traits.

use sled_extensions::{Config, DbExt};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let db = Config::default().temporary(true).start()?;
    let tree = db.open_json_tree::<usize>("json-tree")?;

    tree.insert(b"hey", 32)?;

    if let Some(num) = tree.get(b"hey")? {
        assert_eq!(num, 32);
    } else {
        unreachable!("Shouldn't be empty");
    }

    Ok(())
}

Available features

  • bincode - Enable storing bincode-encoded data
  • cbor - Enable storing cbor-encoded data
  • json - Enable storing json-encoded data

Contributing

Unless otherwise stated, all contributions to this project will be licensed under the CSL with the exceptions listed in the License section of this file.

License

This work is licensed under the Cooperative Software License. This is not a Free Software License, but may be considered a "source-available License." For most hobbyists, self-employed developers, worker-owned companies, and cooperatives, this software can be used in most projects so long as this software is distributed under the terms of the CSL. For more information, see the provided LICENSE file. If none exists, the license can be found online here. If you are a free software project and wish to use this software under the terms of the GNU Affero General Public License, please contact me at asonix@asonix.dog and we can sort that out. If you wish to use this project under any other license, especially in proprietary software, the answer is likely no.

Dependencies

~3.5–5MB
~87K SLoC