Struct cw_storage_plus::MultiIndex
source · [−]pub struct MultiIndex<'a, K, T> { /* private fields */ }
Expand description
MultiIndex stores (namespace, index_name, idx_value, pk) -> b“pk_len“. Allows many values per index, and references pk. The associated primary key value is stored in the main (pk_namespace) map, which stores (namespace, pk_namespace, pk) -> value.
The stored pk_len is used to recover the pk from the index namespace, and perform the secondary load of the associated value from the main map.
The MultiIndex definition must include a field for the pk. That is, the MultiIndex K value is always a n-tuple (n >= 2) and its last element must be the pk. The index function must therefore put the pk as last element, when generating the index.
Implementations
sourceimpl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
impl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
sourceimpl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
K: PrimaryKey<'a>,
impl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
K: PrimaryKey<'a>,
sourceimpl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
K: PrimaryKey<'a>,
K::SubPrefix: EmptyPrefix,
impl<'a, K, T> MultiIndex<'a, K, T> where
T: Serialize + DeserializeOwned + Clone,
K: PrimaryKey<'a>,
K::SubPrefix: EmptyPrefix,
pub fn range<'c>(
&'c self,
store: &'c dyn Storage,
min: Option<Bound>,
max: Option<Bound>,
order: Order
) -> Box<dyn Iterator<Item = StdResult<Pair<T>>> + 'c> where
T: 'c,
pub fn keys<'c>(
&'c self,
store: &'c dyn Storage,
min: Option<Bound>,
max: Option<Bound>,
order: Order
) -> Box<dyn Iterator<Item = Vec<u8>> + 'c>
Trait Implementations
Auto Trait Implementations
impl<'a, K, T> RefUnwindSafe for MultiIndex<'a, K, T> where
K: RefUnwindSafe,
impl<'a, K, T> Send for MultiIndex<'a, K, T> where
K: Send,
impl<'a, K, T> Sync for MultiIndex<'a, K, T> where
K: Sync,
impl<'a, K, T> Unpin for MultiIndex<'a, K, T> where
K: Unpin,
impl<'a, K, T> UnwindSafe for MultiIndex<'a, K, T> where
K: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more