Crate sled_extensions

Source
Expand description

§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, Db, DbExt};

let db = Config::default().temporary(true).open()?;
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");
}

Available features

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

Modules§

expiring
Basic expiring trees
structured
Basic structured trees

Structs§

CompareAndSwapError
Compare and swap error.
Config
Top-level configuration for the system.
Db
The sled embedded database!
IVec
A buffer that may either be inline or remote and protected by an Arc

Enums§

Error
The error type for this library
TransactionError
An error type that is returned from the closure passed to the transaction method.

Traits§

DbExt
Extensions for the sled Db type that provides different ways of opening trees for storing structured data.
Encoding
The Encoding trait

Functions§

abort
A simple constructor for Err(TransactionError::Abort(_))

Type Aliases§

Result
An alias for Result<T, sled_extensions::Error>