Index

Trait Index 

Source
pub trait Index<T> {
    // Required methods
    fn insert(&mut self, seal: Seal, op: &Insert<'_, T>);
    fn remove(&mut self, seal: Seal, op: &Remove<'_, T>);

    // Provided method
    fn update(&mut self, seal: Seal, op: &Update<'_, T>) { ... }
}
Expand description

Types that can be used as indexes in a crate::Collection.

An index processes items of type T - and can be accessed through the crate::Collection::query-family of methods to expose queries over the indexed data.

You should only need to know about this trait if you are implementing a custom index.

§Implementing an Index

An Index receives insertions, removals, and updates of items of type T, and maintains some internal state to answer queries about the indexed data.

Indexes must (minimally) handle insertion and removal of items. (Update operation has a default implementation that calls remove followed by insert; override it if a more efficient implementation is possible.)

All trait functions receive a Seal parameter that prevents external code from calling them directly. You can safely ignore this parameter.

All operations receive an operation struct (Insert, Remove, or Update) Insert guarantees that the key did not previously exists, Remove and Update guarantee carry a pointer to the existing value. This usually allows for more efficient implementations.

The queries themselves are not part of this trait - they are implemented as inherent on the index type itself.

Required Methods§

Source

fn insert(&mut self, seal: Seal, op: &Insert<'_, T>)

Source

fn remove(&mut self, seal: Seal, op: &Remove<'_, T>)

Provided Methods§

Source

fn update(&mut self, seal: Seal, op: &Update<'_, T>)

Implementations on Foreign Types§

Source§

impl<In, Ix0, Ix1> Index<In> for (Ix0, Ix1)
where Ix0: Index<In>, Ix1: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2> Index<In> for (Ix0, Ix1, Ix2)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3> Index<In> for (Ix0, Ix1, Ix2, Ix3)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>, Ix11: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>, Ix11: Index<In>, Ix12: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>, Ix11: Index<In>, Ix12: Index<In>, Ix13: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13, Ix14> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13, Ix14)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>, Ix11: Index<In>, Ix12: Index<In>, Ix13: Index<In>, Ix14: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<In, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13, Ix14, Ix15> Index<In> for (Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, Ix7, Ix8, Ix9, Ix10, Ix11, Ix12, Ix13, Ix14, Ix15)
where Ix0: Index<In>, Ix1: Index<In>, Ix2: Index<In>, Ix3: Index<In>, Ix4: Index<In>, Ix5: Index<In>, Ix6: Index<In>, Ix7: Index<In>, Ix8: Index<In>, Ix9: Index<In>, Ix10: Index<In>, Ix11: Index<In>, Ix12: Index<In>, Ix13: Index<In>, Ix14: Index<In>, Ix15: Index<In>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, In>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, In>)

Source§

impl<T> Index<T> for ()

Source§

fn insert(&mut self, _seal: Seal, _op: &Insert<'_, T>)

Source§

fn remove(&mut self, _seal: Seal, _op: &Remove<'_, T>)

Source§

fn update(&mut self, _seal: Seal, _op: &Update<'_, T>)

Source§

impl<T, Inner> Index<T> for Option<Inner>
where Inner: Index<T>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, T>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, T>)

Source§

fn update(&mut self, seal: Seal, op: &Update<'_, T>)

Source§

impl<T, Inner> Index<T> for Vec<Inner>
where Inner: Index<T>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, T>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, T>)

Source§

fn update(&mut self, seal: Seal, op: &Update<'_, T>)

Source§

impl<T, Inner, const N: usize> Index<T> for [Inner; N]
where Inner: Index<T>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, T>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, T>)

Source§

fn update(&mut self, seal: Seal, op: &Update<'_, T>)

Source§

impl<T, Left, Right> Index<T> for Result<Left, Right>
where Left: Index<T>, Right: Index<T>,

Source§

fn insert(&mut self, seal: Seal, op: &Insert<'_, T>)

Source§

fn remove(&mut self, seal: Seal, op: &Remove<'_, T>)

Source§

fn update(&mut self, seal: Seal, op: &Update<'_, T>)

Implementors§

Source§

impl Index<bool> for Boolean

Source§

impl Index<u32> for Bitmap

Source§

impl Index<u64> for Treemap

Source§

impl<In, GroupKey, InnerIndex, S> Index<In> for Grouped<In, GroupKey, InnerIndex, S>
where GroupKey: Eq + Hash + Clone, InnerIndex: Index<In> + Clone, S: BuildHasher + Clone,

Source§

impl<In, InnerIn, Inner> Index<In> for Premap<In, InnerIn, Inner>
where Inner: Index<InnerIn>,

Source§

impl<In, InnerIn, Inner> Index<In> for PremapOwned<In, InnerIn, Inner>
where Inner: Index<InnerIn>,

Source§

impl<In, KeySet_> Index<In> for composable_indexes::index::im::BTree<In, KeySet_>
where In: Ord + Clone, KeySet_: KeySet + Clone,

Source§

impl<In, KeySet_> Index<In> for composable_indexes::index::im::HashTable<In, KeySet_>
where In: Eq + Hash + Clone, KeySet_: KeySet + Clone,

Source§

impl<In, KeySet_: KeySet> Index<In> for Keys<KeySet_>

Source§

impl<In, Out, Inner> Index<In> for Filtered<In, Out, Inner>
where Inner: Index<Out>,

Source§

impl<In, Query, State> Index<In> for GenericAggregate<In, Query, State>
where State: 'static, Query: 'static, In: 'static,

Source§

impl<In, S, KeySet_> Index<In> for composable_indexes::index::HashTable<In, S, KeySet_>
where In: Eq + Hash + Clone, S: BuildHasher, KeySet_: KeySet,

Source§

impl<In: Ord + Clone, KeySet_: KeySet> Index<In> for composable_indexes::index::BTree<In, KeySet_>

Source§

impl<KeySet_> Index<String> for SuffixTree<KeySet_>
where KeySet_: KeySet,

Source§

impl<T> Index<T> for Mean<T>
where T: ToPrimitive + Copy + 'static,

Source§

impl<T> Index<T> for StdDev<T>
where T: ToPrimitive + Copy + 'static,

Source§

impl<T> Index<T> for Sum<T>
where T: Num + Copy + 'static,

Source§

impl<T, S, O> Index<T> for MonoidalAggregate<T, S, O>

Source§

impl<T: Clone> Index<T> for TestIndex<T>

Source§

impl<_K> Index<_K> for Count