pub trait ReadableTable<K: RedbKey + ?Sized, V: RedbValue + ?Sized> {
    fn get(
        &self,
        key: &K
    ) -> Result<Option<<<V as RedbValue>::View as WithLifetime<'_>>::Out>, Error>; fn range<'a, T: RangeBounds<KR>, KR: Borrow<K> + 'a>(
        &'a self,
        range: T
    ) -> Result<RangeIter<'_, K, V>, Error>; fn len(&self) -> Result<usize, Error>; fn is_empty(&self) -> Result<bool, Error>; }

Required Methods

Returns the value corresponding to the given key

Returns a double-ended iterator over a range of elements in the table

Examples

Usage:

use redb::*;
const TABLE: TableDefinition<str, u64> = TableDefinition::new("my_data");

let db = unsafe { Database::create(filename, db_max_size)? };
let write_txn = db.begin_write()?;
{
    let mut table = write_txn.open_table(TABLE)?;
    table.insert("a", &0)?;
    table.insert("b", &1)?;
    table.insert("c", &2)?;
}
write_txn.commit()?;

let read_txn = db.begin_read()?;
let table = read_txn.open_table(TABLE)?;
let mut iter = table.range("a".."c")?;
assert_eq!(Some(("a", 0)), iter.next());

Returns the number of entries in the table

Returns true if the table is empty

Implementors