Skip to main content

HalfJoinState

Trait HalfJoinState 

Source
pub trait HalfJoinState<Key, ValBuild, ValProbe>
where ValBuild: Clone,
{ // Required methods fn build(&mut self, k: Key, v: Cow<'_, ValBuild>) -> bool; fn probe( &mut self, k: &Key, v: &ValProbe, ) -> Option<(Key, ValProbe, ValBuild)>; fn pop_match(&mut self) -> Option<(Key, ValProbe, ValBuild)>; fn len(&self) -> usize; fn iter(&self) -> Iter<'_, Key, SmallVec<[ValBuild; 1]>>; fn full_probe(&self, k: &Key) -> Iter<'_, ValBuild>; fn clear(&mut self); // Provided method fn is_empty(&self) -> bool { ... } }
Available on crate feature std only.
Expand description

State semantics for each half of a join.

This trait defines the interface for storing and probing join state. Different implementations provide different semantics (set vs multiset).

Required Methods§

Source

fn build(&mut self, k: Key, v: Cow<'_, ValBuild>) -> bool

Insert a key-value pair into the join state.

Returns true if the pair was inserted (implementation-defined for duplicates).

Source

fn probe(&mut self, k: &Key, v: &ValProbe) -> Option<(Key, ValProbe, ValBuild)>

Probe the join state for matches with the given key and value.

Returns the first match directly. Additional matches are stored internally and can be retrieved with pop_match.

Source

fn pop_match(&mut self) -> Option<(Key, ValProbe, ValBuild)>

Pop a stored match from previous probe calls.

Source

fn len(&self) -> usize

Returns the number of keys in the join state.

Source

fn iter(&self) -> Iter<'_, Key, SmallVec<[ValBuild; 1]>>

Returns an iterator over all entries in the state.

Source

fn full_probe(&self, k: &Key) -> Iter<'_, ValBuild>

Returns an iterator over all values for a given key.

Source

fn clear(&mut self)

Clear the state without de-allocating.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the state is empty.

Implementors§

Source§

impl<Key, ValBuild, ValProbe> HalfJoinState<Key, ValBuild, ValProbe> for HalfMultisetJoinState<Key, ValBuild, ValProbe>
where Key: Clone + Eq + Hash, ValBuild: Clone, ValProbe: Clone,

Source§

impl<Key, ValBuild, ValProbe> HalfJoinState<Key, ValBuild, ValProbe> for HalfSetJoinState<Key, ValBuild, ValProbe>
where Key: Clone + Eq + Hash, ValBuild: Clone + Eq, ValProbe: Clone,