Trait grove::locators::Locator[][src]

pub trait Locator<D: Data>: Clone {
    fn locate(
        &self,
        left: D::Summary,
        node: &D::Value,
        right: D::Summary
    ) -> LocResult; }
Expand description

Locators are type that represent a segment of the tree. When the locator is used, we query the locator about the current node. The locator has to reply:

  • If the current node is to the left of the segment, return GoRight.
  • If the current node is to the right of the segment, return GoLeft
  • If the current node is part of the segment, return Accept.

In each query, the locator receives as input the current node’s value, the accumulated summary left of the current node, and the accumulated summary right of the current node. Note that the subtree of the current node is irrelevant: only the current node’s value matters.

References to anonymous functions of the type Fn(...) -> LocResult can be used as locators.

Locators are immutable, and therefore it is assumed that they can be called in any order, i.e., earlier calls will not change the result of later calls. This is even though that might not be the case, using interior mutability. Locators must be Clone, in order for usage to be comfortable. This can always be achieved by taking a reference.

Required methods

Looks at a specific node’s value, and its context (the summaries to the right and left), and decides whether to go left, right, or accept the node.

Implementations on Foreign Types

Locator instance for usize representing a single index.

Locator instance for std::ops::RangeFull.

Locator instance for a reference to std::ops::RangeFull.

Locator instance for std::ops::Range<usize> representing an index range.

Locator instance for a reference to std::ops::Range<usize> representing an index range.

Locator instance for std::ops::RangeInclusive<usize> representing an index range. Do not use with ranges that have been iterated on to exhaustion.

Locator instance fora reference to std::ops::RangeInclusive<usize> representing an index range. Do not use with ranges that have been iterated on to exhaustion.

Locator instance for std::ops::RangeFrom<usize> representing an index range.

Locator instance for a reference to std::ops::RangeFrom<usize> representing an index range.

Locator instance for std::ops::RangeTo<usize> representing an index range.

Locator instance for a referencfe to std::ops::RangeTo<usize> representing an index range.

Locator instance for std::ops::RangeToInclusive<usize> representing an index range. Do not use with ranges that have been iterated on to exhaustion.

Locator instance for a reference to std::ops::RangeToInclusive<usize> representing an index range. Do not use with ranges that have been iterated on to exhaustion.

Implementors

Can’t be an instance for ByKey<D::Value::Key> directly, because the Key might itself be a range type, and so it would conflict with the other implementations.

Locator instance for ByKey<std::ops::RangeFull>.

Locator instance for ByKey<std::ops::Range<D::Value::Key>> representing searching by a key.

Locator instance for ByKey<std::ops::RangeFrom<D::Value::Key>> representing an index range.

Locator instance for ByKey<std::ops::RangeInclusive<D::Value::Key>> representing searching by a key. Do not use with ranges that have been iterated on to exhaustion.

Locator instance for ByKey<std::ops::RangeTo<D::Value::Key>> representing searching by a key.

Locator instance for ByKey<std::ops::RangeToInclusive<D::Value::Key>> representing searching by a key.