Struct rustla::doctree::DocTree [−][src]
A container for the document tree. In addition to holding ownership of the tree (stored in a zipper), also contains metadata about the tree.
Implementations
impl DocTree
[src]
pub fn write_to_larst(self, rustla_options: &ruSTLaOptions)
[src]
A function that writes a rusTLa doctree into stdout
or a file, depending on the given output option.
impl DocTree
[src]
pub fn perform_restructuredtext_transforms(self) -> Self
[src]
Modifies self.tree
with the known reStrucuturedText transforms.
impl DocTree
[src]
Walkers
Functions for walking to differents parts of the contained TreeZipper
.
These include ID-based searches, as well as criteria related to the
contained data variant.
pub fn walk_to_root(self) -> Self
[src]
Walks to the root of the contained tree zipper.
pub fn walk(self, traversal_type: TraversalType) -> Self
[src]
The mother of all walkers. Performs a tree walk based on given TraversalType
.
These include walking to a specific node id, but a reference to a TreeNodeType
might also be used in determining when to stop walking.
impl DocTree
[src]
Document tree container methods
pub fn new(doc_name: PathBuf) -> Self
[src]
A DocTree
constructor.
pub fn n_of_nodes(&self) -> NodeId
[src]
Returns the value of the contnained node counter.
pub fn print_tree(&self)
[src]
Mainly for debugging purposes. Prints the contaiend tree, focused on the current node.
pub fn node_count(&self) -> NodeId
[src]
Returns a copy of the current node count in the DocTree.
pub fn print_internal_labels(&self)
[src]
mainly for debugging purposes
Prints out the internal targe labels stored in self.hyperref_data
currently being worked on.
pub fn focus_on_parent(self) -> Self
[src]
Focuses self.tree
on its parent node if there is one.
pub fn push_data_and_focus(self, node_data: TreeNodeType) -> Result<Self, Self>
[src]
Creates a new node from given data, pushes it to the children of currently focused on node and focuses on the new node.
If this succeeds, also increments self.node_count
.
Returns Result::{Ok(self), Err(self)}
, depending on the success of this operation.
pub fn push_data(self, node_data: TreeNodeType) -> Result<Self, Self>
[src]
Creates a new node from given data and pushes it to the children of currently focused on node.
If this succeeds, also increments self.node_count
.
Returns self in either Ok
or an Err
.
pub fn push_child(&mut self, node: TreeNode) -> Result<(), TreeNode>
[src]
Pushes a new node to the children of the node currently focused on.
If the addition was successful, returns Ok(())
, else returns the given node wrapped in an Err
.
pub fn pop_child(&mut self) -> Option<TreeNode>
[src]
Removes the last child of the current node and returns in an Option
.
pub fn shared_node(&self) -> &TreeNode
[src]
Returns a shared reference to the current node .
pub fn mut_node(&mut self) -> &mut TreeNode
[src]
Returns a shared reference to the current node .
pub fn shared_children(&self) -> Option<&Vec<TreeNode>>
[src]
Returns an optional shared reference to the current node’s children, if the exist.
pub fn mut_children(&mut self) -> Option<&mut Vec<TreeNode>>
[src]
Returns an optional mutable reference to the current node’s children, if the exist.
pub fn shared_node_data(&self) -> &TreeNodeType
[src]
Retrieves a shared reference to the data of the currently focused on node.
pub fn mut_node_data(&mut self) -> &mut TreeNodeType
[src]
Retrieves a shared reference to the data of the currently focused on node.
pub fn get_child_data(&self, index: usize) -> &TreeNodeType
[src]
Retrieves a shared reference to the data of the given child of the current node.
pub fn n_of_children(&self) -> usize
[src]
pub fn get_mut_child_data(&mut self, index: usize) -> &mut TreeNodeType
[src]
Retrieves a mutable reference to the data of the given child of the current node.
pub fn shared_child(&self, index: usize) -> Option<&TreeNode>
[src]
Retrieves a shared reference to a given child.
pub fn mut_child(&mut self, index: usize) -> Option<&mut TreeNode>
[src]
Retrieves a shared reference to a given child.
pub fn shared_sibling_data(&self, sibling_index: usize) -> Option<&TreeNodeType>
[src]
Retrieves the node data of a sibling of the currently focused-on node with the given index.
pub fn index_in_parent(&self) -> Option<usize>
[src]
Retrieves the index of the current node with respect to its parent.
pub fn append_children(&mut self, nodes: &mut Vec<TreeNode>)
[src]
Appends the nodes given in a given vector of nodes to the currently
focused on node in self.tree
.
pub fn has_target_label(&self, label_to_be_inspected_for: &str) -> bool
[src]
Checks whether the doctree already contains a hyperlink target with the given label.
pub fn has_reference_label(&self, label_to_be_inspected_for: &str) -> bool
[src]
Checks whether the doctree already contains a hyperlink reference with the given label.
pub fn current_node_id(&self) -> NodeId
[src]
Retrieves a copy of the node id currently focused on.
pub fn push_to_internal_target_stack(&mut self, label: String)
[src]
Pushes a given label to the chain of detected internal target labels. Once a non-internal target is encountered, this array of labels will be made to point to the newly detected node and cleared.
pub fn n_of_symbolic_footnotes(&self) -> u32
[src]
Returns the number of symbolic footnotes that have been entered into the doctree.
pub fn n_of_symbolic_footnote_refs(&self) -> u32
[src]
Returns the number of symbolic footnote references that have been entered into the doctree.
pub fn increment_symbolic_footnotes(&mut self)
[src]
Increments symbolic footnote counter of the doctree by 1.
pub fn increment_symbolic_footnote_refs(&mut self)
[src]
Increments symbolic footnote reference counter of the doctree by 1.
pub fn increment_anon_targets(&mut self)
[src]
Increases the counter for anonymous targets entered into the doctree thus far by one.
pub fn increment_anon_references(&mut self)
[src]
Increases the counter for anonymous targets entered into the doctree thus far by one.
pub fn next_anon_target_n(&mut self) -> u32
[src]
Increments the anon target counter and returns a copy of the result.
pub fn next_anon_reference_n(&mut self) -> u32
[src]
Increments the anon reference counter and returns a copy of the result.
pub fn next_anon_target_label(&mut self) -> String
[src]
Returns an allocated String representation of the next anonymous target label.
pub fn next_anon_reference_label(&mut self) -> String
[src]
Returns an allocated String representation of the next anonymous reference label.
pub fn shared_targets(&self) -> &HashMap<String, NodeId>
[src]
Returns a shared reference to self.targets
.
pub fn mut_targets(&mut self) -> &mut HashMap<String, NodeId>
[src]
Returns a mutable reference to self.targets
.
pub fn shared_references(&self) -> &HashMap<String, Vec<NodeId>>
[src]
Returns a shared reference to self.references
.
pub fn mut_references(&mut self) -> &mut HashMap<String, Vec<NodeId>>
[src]
Returns a mutable reference to self.references
.
pub fn new_section_data(
&self,
title_text: &str,
section_style: SectionLineStyle
) -> TreeNodeType
[src]
&self,
title_text: &str,
section_style: SectionLineStyle
) -> TreeNodeType
Generates a new section node data container by comparing the given section_style
to known styles
and corresponding levels via self.section_levels
. If a section of such style already exists, the level of the section
is simply set to the level matching it. If not, the maximum known level is plus 1
is assigned to the section data.
Note that this function does not yet modify known section data or hyperref targets.
This is donw only if pushing the node data to the tree succeeds, and is handled
by the related methods.
pub fn add_section(
self,
title_text: &str,
section_style: SectionLineStyle
) -> Self
[src]
self,
title_text: &str,
section_style: SectionLineStyle
) -> Self
Adds a new section to the doctree, also taking care of adding the section title to the hyperref data of the tree, updating the section counter and mapping the section type to the appropriate section level.
pub fn walk_to_parent_section_level(self, level: usize) -> Self
[src]
Walks up the tree to a given section level.
pub fn shared_parent_ref(&self) -> Option<&TreeZipper>
[src]
Returns an Option
al shared reference to the parent node.
pub fn shared_data(&self) -> &TreeNodeType
[src]
Returns a shared reference to the data of the current node.
pub fn shared_parent_data(&self) -> Option<&TreeNodeType>
[src]
Returns an Option
al shared reference to parent node data.
pub fn new_symbolic_footnote_label(&self) -> Option<String>
[src]
Generates a new symbolic footnote label, wrapped in an Option
.
Does not increment the symbolic footnote counter,
as at the point of calling this function we have no information about whether the
insertion of the respective node into the doctree succeeded.
pub fn new_symbolic_footnote_ref_label(&self) -> Option<String>
[src]
Generates a new symbolic footnote reference label, wrapped in an Option
.
Does not increment the symbolic footnote counter,
as at the point of calling this function we have no information about whether the
insertion of the respective node into the doctree succeeded.
pub fn new_autonumber_footnote_label(&self) -> Option<String>
[src]
Generates a new footnote number based on existing footnote labels. Again, does not modify the doctree, as knowledge about node insertion success is nil at this point.
pub fn new_autonumber_footnote_ref_label(&self) -> Option<String>
[src]
Generates a new footnote reference number based on existing footnote reference labels. Again, does not modify the doctree, as knowledge about node insertion success is nil at this point.
Auto Trait Implementations
impl RefUnwindSafe for DocTree
impl Send for DocTree
impl Sync for DocTree
impl Unpin for DocTree
impl UnwindSafe for DocTree
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,