Skip to main content

InternalNodeSpec

Trait InternalNodeSpec 

Source
pub trait InternalNodeSpec: NodeSpec {
    // Required methods
    fn set_first_child(&mut self, new: Rc<RefCell<NodeCore<dyn NodeSpec>>>);
    fn unset_first_child(&mut self);
    fn set_last_child(&mut self, new: Rc<RefCell<NodeCore<dyn NodeSpec>>>);
    fn unset_last_child(&mut self);

    // Provided methods
    fn pre_child_removal(
        &mut self,
        removed_child: Node<dyn NodeSpec>,
    ) -> Result<(), XMLTreeError> { ... }
    fn pre_child_insertion(
        &self,
        inserted_child: Node<dyn NodeSpec>,
        preceding_node: Option<Node<dyn NodeSpec>>,
    ) -> Result<(), XMLTreeError> { ... }
    fn post_child_insertion(&mut self, inserted_child: Node<dyn NodeSpec>) { ... }
}
Expand description

Common traits of internal nodes (i.e., nodes that are not leaf nodes).

This trait is not intended to be implemented by library users and should not be implemented.

Required Methods§

Source

fn set_first_child(&mut self, new: Rc<RefCell<NodeCore<dyn NodeSpec>>>)

Set the pointer of the first child.

Source

fn unset_first_child(&mut self)

Unset the pointer of the first child.

Source

fn set_last_child(&mut self, new: Rc<RefCell<NodeCore<dyn NodeSpec>>>)

Set the pointer of the last child.

Source

fn unset_last_child(&mut self)

Unset the pointer of the last child.

Provided Methods§

Source

fn pre_child_removal( &mut self, removed_child: Node<dyn NodeSpec>, ) -> Result<(), XMLTreeError>

The process performed immediately before deleting a child.

Source

fn pre_child_insertion( &self, inserted_child: Node<dyn NodeSpec>, preceding_node: Option<Node<dyn NodeSpec>>, ) -> Result<(), XMLTreeError>

Perform preprocessing when inserted_child is inserted following preceding_node.

If there is no preceding node (i.e., inserted_child is inserted as the first child), preceding_node is None.

Only perform precondition checks; do not cause side effects.

Source

fn post_child_insertion(&mut self, inserted_child: Node<dyn NodeSpec>)

Perform postprocessing when inserted_child is inserted following preceding_node.

If there is no preceding node (i.e., inserted_child is inserted as the first child), preceding_node is None.

Assume all prerequisites are satisfied; errors must not occur.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§