pub trait Applier: Any {
// Required methods
fn create(&mut self, node: Box<dyn Node>) -> NodeId;
fn get_mut(&mut self, id: NodeId) -> Result<&mut dyn Node, NodeError>;
fn remove(&mut self, id: NodeId) -> Result<(), NodeError>;
fn insert_with_id(
&mut self,
id: NodeId,
node: Box<dyn Node>,
) -> Result<(), NodeError>;
// Provided methods
fn as_any(&self) -> &dyn Any
where Self: Sized { ... }
fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized { ... }
}Required Methods§
fn create(&mut self, node: Box<dyn Node>) -> NodeId
fn get_mut(&mut self, id: NodeId) -> Result<&mut dyn Node, NodeError>
fn remove(&mut self, id: NodeId) -> Result<(), NodeError>
Sourcefn insert_with_id(
&mut self,
id: NodeId,
node: Box<dyn Node>,
) -> Result<(), NodeError>
fn insert_with_id( &mut self, id: NodeId, node: Box<dyn Node>, ) -> Result<(), NodeError>
Inserts a node with a pre-assigned ID.
This is used for virtual nodes whose IDs are allocated separately
(e.g., via allocate_virtual_node_id()). Unlike create() which assigns
a new ID, this method uses the provided ID.
Returns Ok(()) if successful, or an error if the ID is already in use.