[][src]Struct syntax_tree::Node

pub struct Node<T> { /* fields omitted */ }

Methods

impl<T> Node<T>[src]

pub fn new_leaf(text: String, obj: Option<Rc<T>>) -> Node<T>[src]

Create new leaf node.

pub fn new() -> Node<T>[src]

Create new node.

pub fn is_leaf(&self) -> bool[src]

Check whether this node is a

pub fn add_child(&mut self, child: Node<T>)[src]

Add a child to this node.

pub fn text(&self) -> String[src]

Get text the node (or children) is/are holding.

pub fn length(&self) -> usize[src]

Length of the underlying text.

pub fn obj(&self) -> Option<&Rc<T>>[src]

Get the object the node is holding.

pub fn set(
    &mut self,
    start_idx: usize,
    end_idx: usize,
    obj: Rc<T>
) -> Option<Vec<Node<T>>>
[src]

Set syntax/format info for the passed range. The range is the passed start index (inclusive) to the passed end index (exclusive). Returns a list of nodes to replace the current one in case that is needed (optional).

pub fn insert(&mut self, idx: usize, ch: char)[src]

Insert a char in the underlying text.

pub fn insert_str(&mut self, idx: usize, string: &str)[src]

Insert a string in the underlying text.

pub fn push(&mut self, ch: char)[src]

Push a char to the underlying text.

pub fn push_str(&mut self, string: &str)[src]

Push a string to the underlying text.

pub fn child_count(&self) -> usize[src]

Get the count of children under this node.

pub fn children(&self) -> &[Node<T>][src]

Get a slice of all children under this node.

pub fn pre_order_iter(&self) -> PreOrder<T>[src]

Get a depth first pre order iterator.

pub fn leaf_iter(&self) -> impl Iterator<Item = Item<T>>[src]

Get a leaf iterator.

Trait Implementations

impl<T> Debug for Node<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Node<T>

impl<T> !Send for Node<T>

impl<T> !Sync for Node<T>

impl<T> Unpin for Node<T>

impl<T> UnwindSafe for Node<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.