heed/
iteration_method.rs

1//! The set of possible iteration methods for the different iterators.
2
3use crate::cursor::MoveOperation;
4
5/// The trait used to define the way iterators behave.
6pub trait IterationMethod {
7    /// The internal operation to move the cursor through entries.
8    const MOVE_OPERATION: MoveOperation;
9}
10
11/// Moves to the next or previous key if there
12/// are no more values associated with the current key.
13#[derive(Debug, Clone, Copy)]
14pub enum MoveThroughDuplicateValues {}
15
16impl IterationMethod for MoveThroughDuplicateValues {
17    const MOVE_OPERATION: MoveOperation = MoveOperation::Any;
18}
19
20/// Moves between keys and ignores the duplicate values of keys.
21#[derive(Debug, Clone, Copy)]
22pub enum MoveBetweenKeys {}
23
24impl IterationMethod for MoveBetweenKeys {
25    const MOVE_OPERATION: MoveOperation = MoveOperation::NoDup;
26}
27
28/// Moves only on the duplicate values of a given key and ignores other keys.
29#[derive(Debug, Clone, Copy)]
30pub enum MoveOnCurrentKeyDuplicates {}
31
32impl IterationMethod for MoveOnCurrentKeyDuplicates {
33    const MOVE_OPERATION: MoveOperation = MoveOperation::Dup;
34}