Struct ego_tree::NodeRef

source ·
pub struct NodeRef<'a, T: 'a> { /* private fields */ }
Expand description

Node reference.

Implementations§

source§

impl<'a, T: 'a> NodeRef<'a, T>

source

pub fn ancestors(&self) -> Ancestors<'a, T>

Returns an iterator over ancestors.

source

pub fn prev_siblings(&self) -> PrevSiblings<'a, T>

Returns an iterator over previous siblings.

source

pub fn next_siblings(&self) -> NextSiblings<'a, T>

Returns an iterator over next siblings.

source

pub fn first_children(&self) -> FirstChildren<'a, T>

Returns an iterator over first children.

source

pub fn last_children(&self) -> LastChildren<'a, T>

Returns an iterator over last children.

source

pub fn children(&self) -> Children<'a, T>

Returns an iterator over children.

source

pub fn traverse(&self) -> Traverse<'a, T>

Returns an iterator which traverses the subtree starting at this node.

source

pub fn descendants(&self) -> Descendants<'a, T>

Returns an iterator over this node and its descendants.

source§

impl<'a, T: 'a> NodeRef<'a, T>

source

pub fn id(&self) -> NodeId

Returns the ID of this node.

source

pub fn tree(&self) -> &'a Tree<T>

Returns the tree owning this node.

source

pub fn value(&self) -> &'a T

Returns the value of this node.

source

pub fn parent(&self) -> Option<Self>

Returns the parent of this node.

source

pub fn prev_sibling(&self) -> Option<Self>

Returns the previous sibling of this node.

source

pub fn next_sibling(&self) -> Option<Self>

Returns the next sibling of this node.

source

pub fn first_child(&self) -> Option<Self>

Returns the first child of this node.

source

pub fn last_child(&self) -> Option<Self>

Returns the last child of this node.

source

pub fn has_siblings(&self) -> bool

Returns true if this node has siblings.

source

pub fn has_children(&self) -> bool

Returns true if this node has children.

Trait Implementations§

source§

impl<'a, T: 'a> Clone for NodeRef<'a, T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, T: Debug + 'a> Debug for NodeRef<'a, T>

source§

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

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

impl<'a, T: 'a> From<NodeMut<'a, T>> for NodeRef<'a, T>

source§

fn from(node: NodeMut<'a, T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T: 'a> PartialEq for NodeRef<'a, T>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T: 'a> Copy for NodeRef<'a, T>

source§

impl<'a, T: 'a> Eq for NodeRef<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for NodeRef<'a, T>

§

impl<'a, T> RefUnwindSafe for NodeRef<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for NodeRef<'a, T>
where T: Sync,

§

impl<'a, T> Sync for NodeRef<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for NodeRef<'a, T>

§

impl<'a, T> UnwindSafe for NodeRef<'a, T>
where T: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.