pub struct Multimap<'a, BS>(/* private fields */);Expand description
Multimap stores multiple values per key in a Hamt of Amts. The order of insertion of values for each key is retained.
Implementations§
Source§impl<'a, BS> Multimap<'a, BS>where
BS: Blockstore,
impl<'a, BS> Multimap<'a, BS>where
BS: Blockstore,
Sourcepub fn new(bs: &'a BS, outer_bitwidth: u32, inner_bitwidth: u32) -> Self
pub fn new(bs: &'a BS, outer_bitwidth: u32, inner_bitwidth: u32) -> Self
Initializes a new empty multimap. The outer_bitwidth is the width of the HAMT and the inner_bitwidth is the width of the AMTs inside of it.
Sourcepub fn from_root(
bs: &'a BS,
cid: &Cid,
outer_bitwidth: u32,
inner_bitwidth: u32,
) -> Result<Self, Error>
pub fn from_root( bs: &'a BS, cid: &Cid, outer_bitwidth: u32, inner_bitwidth: u32, ) -> Result<Self, Error>
Initializes a multimap from a root Cid
Sourcepub fn add<V>(&mut self, key: BytesKey, value: V) -> Result<(), Error>where
V: Serialize + DeserializeOwned,
pub fn add<V>(&mut self, key: BytesKey, value: V) -> Result<(), Error>where
V: Serialize + DeserializeOwned,
Adds a value for a key.
Sourcepub fn get<V>(&self, key: &[u8]) -> Result<Option<Array<'a, V, BS>>, Error>where
V: DeserializeOwned + Serialize,
pub fn get<V>(&self, key: &[u8]) -> Result<Option<Array<'a, V, BS>>, Error>where
V: DeserializeOwned + Serialize,
Gets the Array of value type V using the multimap store.
Auto Trait Implementations§
impl<'a, BS> Freeze for Multimap<'a, BS>
impl<'a, BS> RefUnwindSafe for Multimap<'a, BS>where
BS: RefUnwindSafe,
impl<'a, BS> Send for Multimap<'a, BS>where
BS: Sync,
impl<'a, BS> !Sync for Multimap<'a, BS>
impl<'a, BS> Unpin for Multimap<'a, BS>
impl<'a, BS> UnwindSafe for Multimap<'a, BS>where
BS: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more