Trait NodeActor

Source
pub trait NodeActor: Send + 'static {
    type Error: Debug;
    type OutboundData: CancellableContext;
    type InboundData: Sized;
    type Builder;

    // Required methods
    fn build(builder: Self::Builder) -> (Self::InboundData, Self);
    fn start<'async_trait>(
        self,
        inbound_context: Self::OutboundData,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

The NodeActor is an actor-like service for the node.

Actors may:

  • Handle incoming messages.
    • Perform background tasks.
  • Emit new events for other actors to process.

Required Associated Types§

Source

type Error: Debug

The error type for the actor.

Source

type OutboundData: CancellableContext

The communication context used by the actor. These are the channels that the actor will use to send messages to other actors.

Source

type InboundData: Sized

The inbound communication channels used by the actor. These are the channels that the actor will use to receive messages from other actors.

Source

type Builder

The configuration needed to build the actor.

Required Methods§

Source

fn build(builder: Self::Builder) -> (Self::InboundData, Self)

Builds the actor.

Source

fn start<'async_trait>( self, inbound_context: Self::OutboundData, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Starts the actor.

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§