pub trait DynNode:
Send
+ Any
+ 'static {
// Required methods
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
// Provided methods
fn shutdown(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>> { ... }
fn endpoint(&self) -> Option<&Endpoint> { ... }
fn round_label(&self, _round: u32) -> Option<String> { ... }
}Expand description
Trait for dynamically-typed simulation nodes.
This trait enables type erasure for nodes while preserving essential functionality like shutdown, endpoint access, and type casting.
Required Methods§
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns a mutable reference to this node as Any for downcasting.
Provided Methods§
Sourcefn shutdown(&mut self) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn shutdown(&mut self) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Shuts down this node, performing any necessary cleanup.
The default implementation does nothing and returns success.
§Errors
Returns an error if shutdown fails.
Sourcefn endpoint(&self) -> Option<&Endpoint>
fn endpoint(&self) -> Option<&Endpoint>
Returns a reference to this node’s endpoint, if any.
The default implementation returns None.