pub struct HierarchicalFilters<Key, Filter, Child> { /* private fields */ }
Expand description

Container for types which is support bloom filtering

Implementations§

source§

impl<Key, Filter, Child> HierarchicalFilters<Key, Filter, Child>where Key: Sync + Send, Child: BloomProvider<Key, Filter = Filter>, Filter: FilterTrait<Key>,

source

pub async fn from_vec( group_size: usize, level: usize, childs: Vec<Child> ) -> Self

Create collection from vec

source

pub async fn reload(&mut self)

Reload all filters and recreate container

source

pub async fn push(&mut self, child: Child) -> ChildId

Add child to collection

source

pub async fn extend(&mut self, values: Vec<Child>)

Extends conatiner with values

source§

impl<Key, Filter, Child> HierarchicalFilters<Key, Filter, Child>where Key: Sync + Send, Filter: FilterTrait<Key>,

source

pub fn iter_possible_childs<'a>( &'a self, key: &'a Key ) -> PossibleRevIter<'a, Key, Filter, Child>

Iter over childs which may contain key

source

pub fn iter_possible_childs_rev<'a>( &'a self, key: &'a Key ) -> PossibleRevIter<'a, Key, Filter, Child>

Iter over childs which may contain key in reverse order

source

pub fn add_to_parents(&self, child_id: ChildId, item: &Key)

Add key to all parents in collection

source§

impl<Key, Filter, Child> HierarchicalFilters<Key, Filter, Child>

source

pub fn into_vec(self) -> Vec<Leaf<Child>>

Returns children elements as Vec

source

pub fn pop(&mut self) -> Option<Child>

Remove last child from collection

source

pub fn remove(&mut self, id: ChildId) -> Option<Child>

Remove child by id

source

pub fn last_id(&self) -> Option<ChildId>

Get id of last child

source

pub fn last(&self) -> Option<&Child>

Get last child

source

pub fn get_child(&self, id: ChildId) -> Option<&Leaf<Child>>

Get child by id

source

pub fn get_child_mut(&mut self, id: ChildId) -> Option<&mut Leaf<Child>>

Get mutable child by id

source

pub fn iter(&self) -> impl Iterator<Item = &Child>

Returns a iterator over the childs

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Child>

Returns a iterator over the childs

source

pub fn new(group_size: usize, level: usize) -> Self

Create new container

source

pub fn len(&self) -> usize

Count of childs in container

source

pub fn clear(&mut self)

Clear container

source

pub fn clear_and_get_values(&mut self) -> Vec<Child>

Clear container and return children values as Vec

Trait Implementations§

source§

impl<Key, Filter, Child> BloomProvider<Key> for HierarchicalFilters<Key, Filter, Child>where Key: Sync + Send, Child: BloomProvider<Key>, Filter: FilterTrait<Key>,

§

type Filter = Filter

Inner filter type
source§

fn check_filter<'life0, 'life1, 'async_trait>( &'life0 self, item: &'life1 Key ) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if element in filter
source§

fn check_filter_fast(&self, item: &Key) -> FilterResult

Check if element in filter
source§

fn offload_buffer<'life0, 'async_trait>( &'life0 mut self, needed_memory: usize, level: usize ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns freed memory
source§

fn get_filter<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Option<Filter>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns overall filter
source§

fn filter_memory_allocated<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns allocated memory
source§

fn get_filter_fast(&self) -> Option<&Filter>

Returns overall filter
source§

impl<K, F, T> Debug for HierarchicalFilters<K, F, T>where F: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
source§

impl<Key, Filter, Child> IntoIterator for HierarchicalFilters<Key, Filter, Child>where Key: Sync + Send, Child: BloomProvider<Key>,

§

type Item = Leaf<Child>

The type of the elements being iterated over.
§

type IntoIter = Flatten<IntoIter<Option<Leaf<Child>>, Global>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<Key, Filter, Child> RefUnwindSafe for HierarchicalFilters<Key, Filter, Child>where Child: RefUnwindSafe, Filter: RefUnwindSafe, Key: RefUnwindSafe,

§

impl<Key, Filter, Child> Send for HierarchicalFilters<Key, Filter, Child>where Child: Send, Filter: Send, Key: Send,

§

impl<Key, Filter, Child> Sync for HierarchicalFilters<Key, Filter, Child>where Child: Sync, Filter: Sync, Key: Sync,

§

impl<Key, Filter, Child> Unpin for HierarchicalFilters<Key, Filter, Child>where Child: Unpin, Filter: Unpin, Key: Unpin,

§

impl<Key, Filter, Child> UnwindSafe for HierarchicalFilters<Key, Filter, Child>where Child: UnwindSafe, Filter: UnwindSafe, Key: UnwindSafe,

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.

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.