[][src]Crate sled_extensions

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::{ConfigBuilder, Db, DbExt};

let db = Db::start(ConfigBuilder::default().temporary(true).build())?;
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

Config

A finalized ConfigBuilder that can be use multiple times to open a Tree or Log.

ConfigBuilder

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

Traits

DbExt

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

Encoding

The Encoding trait

Type Definitions

Result

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