Skip to main content

ChildAncestors

Struct ChildAncestors 

Source
pub struct ChildAncestors<'tree, 'chain> { /* private fields */ }
Expand description

The chain of a node’s children, held by a consumer that reads them without descending: what Ancestors::of_children builds. A consumer that does descend, into wrappers whose statements it reads as the body’s own, moves it with descend and ascend rather than building one per level.

It borrows the walk’s chain and owns only the entries below it, so it holds the walk’s Vec immutably for as long as it lives (#1805).

Implementations§

Source§

impl<'tree> ChildAncestors<'tree, '_>

Source

pub fn get(&self) -> Ancestors<'tree, '_>

The children’s Ancestors, with the walk’s fold cache carried — and with it the visited node its word slots serve — and its sibling cache deliberately not: the children are nodes the walk has not recorded. Neither does an iter from it regain the sibling cache once it climbs back into the walk’s own chain. Forwarding the record for that climb was measured and left out: no walk asks for a sibling there, in the suite or the repository corpora (#1871).

Source

pub fn descend(&mut self, child: &Node<'tree>)

Descends into child, one of the nodes this chain describes, so that get answers for its children; undone by ascend. A consumer that reads a body’s statements through the wrappers they sit in — Ruby’s npm under an if, a begin, a call’s argument list — keeps one chain and moves it, where deriving a fresh Ancestors::of_children from the last at each level copies every level derived so far, all of them live at once (#1401 review). Without a known chain there is nothing to move and the answers keep climbing.

Source

pub fn ascend(&mut self)

Undoes one descend. The chain never shrinks below the node it was built for, so a consumer that ascends once too often reads the body’s own chain rather than its parent’s — and trips the assertion in a debug build.

Trait Implementations§

Source§

impl<'tree, 'chain> Debug for ChildAncestors<'tree, 'chain>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tree, 'chain> !RefUnwindSafe for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> !Send for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> !Sync for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> !UnwindSafe for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> Forget for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> Freeze for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> Move for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> Unpin for ChildAncestors<'tree, 'chain>

§

impl<'tree, 'chain> UnsafeUnpin for ChildAncestors<'tree, 'chain>

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.