Enum treap_map::SearchDirection
source · pub enum SearchDirection<W> {
Abort,
Left,
Stop,
Right(W),
LeftOrStop,
RightOrStop(W),
}
Expand description
Represents the directions for the search in accumulate_weight_search
.
This enum is used by the user-provided function to indicate how the search
should proceed or terminate in accumulate_weight_search
.
Variants§
Abort
Indicates to abort the search immediately. This stops further searching in any subtree.
Left
Indicates to continue the search in the left subtree. This is used when the current search result is unacceptable and the search should move left.
Stop
Indicates that the current search result is acceptable and the search should stop.
Right(W)
Indicates to continue the search in the right subtree, with the
provided weight W
. This is used when the current search result is
unacceptable and the search should move right. The user function is
expected to merge the accumulate weight with the node weight and
provide it in this variant to avoid recalculating it in
accumulate_weight_search
.
LeftOrStop
Indicates that the current search result is acceptable, but the search should still continue in the left subtree. If the subtree yields no results, the current result is returned.
RightOrStop(W)
Similar to LeftOrStop
, but for the right subtree.
Indicates that the current search result is acceptable, but the search
should still continue in the right subtree. If the subtree yields
no results, the current result is returned, along with the merged
weight. The user function is expected to merge the accumulate
weight with the node weight and provide it in this variant to avoid
recalculating it in accumulate_weight_search
.
Trait Implementations§
source§impl<W: Debug> Debug for SearchDirection<W>
impl<W: Debug> Debug for SearchDirection<W>
source§impl<W: PartialEq> PartialEq for SearchDirection<W>
impl<W: PartialEq> PartialEq for SearchDirection<W>
source§fn eq(&self, other: &SearchDirection<W>) -> bool
fn eq(&self, other: &SearchDirection<W>) -> bool
self
and other
values to be equal, and is used
by ==
.