Struct rustla::doctree::tree_node::TreeNode[][src]

pub struct TreeNode { /* fields omitted */ }

A tree node that contains a struct of TreeNodeType plus the information needed to traverse the tree.

Implementations

impl TreeNode[src]

pub fn perform_restructuredtext_transforms(&mut self)[src]

Transforms self.data into a different type based on its current value. This is where the recursion really kicks in.

impl TreeNode[src]

pub fn new(
    data: TreeNodeType,
    id: NodeId,
    target_label: Option<Vec<String>>,
    classes: Option<Vec<String>>
) -> Self
[src]

A TreeNode constructor.

pub fn id(&self) -> NodeId[src]

Returns a copy of own id.

pub fn shared_target_label(&self) -> &Option<Vec<String>>[src]

Returns a shared (immutable) reference to the optional target label. If the label is None, as is hasn’t been set, returns an empty string slice instead.

pub fn push_child(&mut self, node: TreeNode) -> Result<(), TreeNode>[src]

Pushes a given child node the the end of self.children.

pub fn pop_child(&mut self) -> Option<Self>[src]

Removes the last child from own children and returns it in a Result, if successful. If no whilc is found, returns Err(()).

pub fn append_children(&mut self, children: &mut Vec<TreeNode>)[src]

Appends multiple children to self.children.

pub fn shared_target_labels(&self) -> &Option<Vec<String>>[src]

Retuns a shared reference to own target labels.

pub fn set_target_label(&mut self, label: Option<Vec<String>>)[src]

Sets the target label of the node to given Option<Vec<String>>.

pub fn shared_children(&self) -> &Option<Vec<TreeNode>>[src]

Optionally returns a shared reference to vector containing child nodes.

pub fn mut_children(&mut self) -> &mut Option<Vec<TreeNode>>[src]

Optionally returns a mutable reference to vector containing child nodes.

pub fn child_is_allowed(&self, node_data: &TreeNodeType) -> bool[src]

Checks whether a node is allowed to be inserted into another node.

pub fn shared_child(&self, index: usize) -> Option<&Self>[src]

Returns a shared reference to a child node of a given index. Panics, if the child does not exist.

pub fn mut_child(&mut self, index: usize) -> Option<&mut Self>[src]

Returns a mutable reference to a child node of a given index. Panics, if the child does not exist.

pub fn shared_data(&self) -> &TreeNodeType[src]

For retrieving an immutable reference to the data type of a node.

pub fn mut_data(&mut self) -> &mut TreeNodeType[src]

For retrieving a mutable reference to the data type of a node.

Trait Implementations

impl Debug for TreeNode[src]

Auto Trait Implementations

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.