Struct grove::trees::slice::Slice[][src]

pub struct Slice<'a, D, T, L> { /* fields omitted */ }
Expand description

Returns a value representing a specific subsegment of the tree. This gives a nicer Interface for tree operations: tree.slice(3..50).act(action) instead of tree.act_segment(3..50, action).

It allows to query the tree for a summary or to apply an action, and other useful operations, with a nicer interface.

This struct essentially just forwards calls, mostly to the methods in the traits in crate::trees.

Implementations

Creates a new slice that represents the locator’s segment in the tree.

Compute the summary of this subsegment.

Apply an action on this subsegment.

Finds any node in the current subsegment. If there isn’t any, it finds the empty location where that node would be instead. Returns a walker at the wanted position.

Iterating on values. This iterator assumes you won’t change the values using interior mutability. If you change the values, The tree summaries will behave incorrectly.

The iterator receives a &mut self argument instead of a &self argument. Because of the way the trees work, immutable iterators can’t be written without either mutable access to the tree, or assuming that the values are Clone.

On the other hand, mutable iterators can’t be written because the values of the nodes must be rebuilt, but they can only be rebuilt after the iterator exits. (This is because rust iterators can’t be streaming iterators). If you want a mutable iterator, use a walker instead.

Assumes that the this subsegment is empty. Inserts the value into the tree into the position of this empty subsegment. If the current subsegment is not empty, returns None.

Removes any value from this subsegment from tree, and returns it. If this subsegment is empty, returns None.

Assumes that the this subsegment is empty. Split out everything to the right of this subsegment, if it is an empty subsegment. Otherwise returns None.

Assumes that the this subsegment is empty. Split out everything to the left of the this subsegment, if it is an empty subsegment. Otherwise returns None.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Creates the summary of a single value.

Creates the summary of a single value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.