Trait Node

Source
pub trait Node: Send + 'static {
    // Provided methods
    fn endpoint(&self) -> Option<&Endpoint> { ... }
    fn shutdown(&mut self) -> impl Future<Output = Result<()>> + Send + '_ { ... }
}
Expand description

Trait for simulation node implementations.

Provides basic functionality for nodes including optional endpoint access and cleanup on shutdown.

For a node to be usable in a simulation, you also need to implement Spawn for your node struct.

Provided Methods§

Source

fn endpoint(&self) -> Option<&Endpoint>

Returns a reference to this node’s endpoint, if any.

The default implementation returns None.

Source

fn shutdown(&mut self) -> impl 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§