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§
Sourcefn build(&mut self, k: Key, v: Cow<'_, ValBuild>) -> bool
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).
Sourcefn probe(&mut self, k: &Key, v: &ValProbe) -> Option<(Key, ValProbe, ValBuild)>
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.
Sourcefn pop_match(&mut self) -> Option<(Key, ValProbe, ValBuild)>
fn pop_match(&mut self) -> Option<(Key, ValProbe, ValBuild)>
Pop a stored match from previous probe calls.
Sourcefn iter(&self) -> Iter<'_, Key, SmallVec<[ValBuild; 1]>>
fn iter(&self) -> Iter<'_, Key, SmallVec<[ValBuild; 1]>>
Returns an iterator over all entries in the state.
Sourcefn full_probe(&self, k: &Key) -> Iter<'_, ValBuild>
fn full_probe(&self, k: &Key) -> Iter<'_, ValBuild>
Returns an iterator over all values for a given key.