pub struct Node<T> { /* private fields */ }
Implementations§
Source§impl<T> Node<T>
impl<T> Node<T>
Sourcepub fn clear_infos(&mut self)
pub fn clear_infos(&mut self)
Clear all infos from this node without recursion in children.
Sourcepub fn remove_info(
&mut self,
start_idx: usize,
end_idx: usize,
info: Rc<T>,
recurse: bool,
) -> Option<Vec<Node<T>>>
pub fn remove_info( &mut self, start_idx: usize, end_idx: usize, info: Rc<T>, recurse: bool, ) -> Option<Vec<Node<T>>>
Remove info from the node. Specify recurse whether the info should be removed from children as well. Since a node can end up useless without info, it might have to be replaced by its children which are then returned by this method.
Sourcepub fn set(
&mut self,
start_idx: usize,
end_idx: usize,
info: Rc<T>,
) -> Option<Vec<Node<T>>>
pub fn set( &mut self, start_idx: usize, end_idx: usize, info: Rc<T>, ) -> Option<Vec<Node<T>>>
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).
Sourcepub fn unset(&mut self, start_idx: usize, end_idx: usize, info: Rc<T>)
pub fn unset(&mut self, start_idx: usize, end_idx: usize, info: Rc<T>)
Unset the passed syntax/format info for the passed range. The range is the passed start index (inclusive) to the passed end index (exclusive).
Sourcepub fn insert_str(&mut self, idx: usize, string: &str)
pub fn insert_str(&mut self, idx: usize, string: &str)
Insert a string in the underlying text.
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Get the count of children under this node.
Sourcepub fn remove(&mut self, idx: usize, count: usize) -> (bool, bool)
pub fn remove(&mut self, idx: usize, count: usize) -> (bool, bool)
Remove a count of characters from the underlying text starting at idx. Removing a character might lead to having an empty leaf left. Method will return boolean tuple with two elements (bool, bool). The first boolean will determine whether the node is unnecessary now, the second boolean determined whether parent may need to regroup its children.
Sourcepub fn give_listener(&mut self, l: &Option<Rc<Listener<T>>>)
pub fn give_listener(&mut self, l: &Option<Rc<Listener<T>>>)
Give node change listener.
Sourcepub fn take_listener(&mut self) -> Option<Rc<Listener<T>>>
pub fn take_listener(&mut self) -> Option<Rc<Listener<T>>>
Take the change listener from this node (if any).
Sourcepub fn pre_order_iter(&self) -> PreOrder<'_, T> ⓘ
pub fn pre_order_iter(&self) -> PreOrder<'_, T> ⓘ
Get a depth first pre order iterator.