pub struct Multimap<'a, BS>(_, _);
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,

source

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.

source

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

source

pub fn root(&mut self) -> Result<Cid, Error>

Retrieve root from the Multimap.

source

pub fn add<V>(&mut self, key: BytesKey, value: V) -> Result<(), Error>where V: Serialize + DeserializeOwned,

Adds a value for a key.

source

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.

source

pub fn remove_all(&mut self, key: &[u8]) -> Result<(), Error>

Removes all values for a key.

source

pub fn for_each<F, V>(&self, key: &[u8], f: F) -> Result<(), Error>where V: Serialize + DeserializeOwned, F: FnMut(u64, &V) -> Result<()>,

Iterates through all values in the array at a given key.

source

pub fn for_all<F, V>(&self, f: F) -> Result<(), Error>where V: Serialize + DeserializeOwned, F: FnMut(&BytesKey, &Array<'_, V, BS>) -> Result<()>,

Iterates through all arrays in the Multimap

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.