Skip to main content

SiblingCache

Struct SiblingCache 

Source
pub struct SiblingCache<'tree>(/* private fields */);
Expand description

The children of each wide node on a walk’s chain, recorded as the walk pushes them, so that Ancestors::siblings_after and Ancestors::siblings_before find a sibling in a flat ERROR without a scan from its start (#1584).

One slot per depth, keyed by the node’s id. A walk descends into a node only after pushing its children, so every wide node on the chain has its slot; a slot left behind by a node the walk has moved past holds another id and is not read. Recording copies what the walk already holds, once per wide node.

Implementations§

Source§

impl<'tree> SiblingCache<'tree>

Source

pub fn record( &mut self, node: &Node<'tree>, depth: usize, children: impl IntoIterator<Item = Node<'tree>>, )

Records children, in order, as the children of node, which sits at depth in the walk’s chain. A node of no more than a short scan’s children is not recorded.

Trait Implementations§

Source§

impl<'tree> Debug for SiblingCache<'tree>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'tree> Default for SiblingCache<'tree>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'tree> Freeze for SiblingCache<'tree>

§

impl<'tree> RefUnwindSafe for SiblingCache<'tree>

§

impl<'tree> Send for SiblingCache<'tree>

§

impl<'tree> Sync for SiblingCache<'tree>

§

impl<'tree> Unpin for SiblingCache<'tree>

§

impl<'tree> UnsafeUnpin for SiblingCache<'tree>

§

impl<'tree> UnwindSafe for SiblingCache<'tree>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.