Type Alias fvm_ipld_amt::Amt

source ·
pub type Amt<V, BS> = AmtImpl<V, BS, V3>;
Expand description

Array Mapped Trie allows for the insertion and persistence of data, serializable to a CID.

Amt is not threadsafe and can’t be shared between threads.

Usage:

use fvm_ipld_amt::Amt;

let db = fvm_ipld_blockstore::MemoryBlockstore::default();
let mut amt = Amt::new(&db);

// Insert or remove any serializable values
amt.set(2, "foo".to_owned()).unwrap();
amt.set(1, "bar".to_owned()).unwrap();
amt.delete(2).unwrap();
assert_eq!(amt.count(), 1);
let bar: &String = amt.get(1).unwrap().unwrap();

// Generate cid by calling flush to remove cache
let cid = amt.flush().unwrap();

Aliased Type§

struct Amt<V, BS> { /* private fields */ }