Skip to main content

Runtime

Trait Runtime 

Source
pub trait Runtime: Send + Sync {
    // Required methods
    fn id(&self) -> RuntimeID;
    fn subscribe_any<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic_name: &'life1 str,
        topic_type: TypeId,
        actor: Arc<dyn AnyActor>,
    ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn publish_any<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic_name: &'life1 str,
        topic_type: TypeId,
        message: Arc<dyn Any + Send + Sync>,
    ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn tx(&self) -> Sender<Event>;
    fn transport<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Arc<dyn Transport>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn take_event_receiver<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<BoxEventStream<Event>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe_events<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = BoxEventStream<Event>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn run<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstract runtime that manages actor subscriptions, pub/sub delivery, and emission of protocol events. Implementations can provide different threading or transport strategies.

Required Methods§

Source

fn id(&self) -> RuntimeID

Source

fn subscribe_any<'life0, 'life1, 'async_trait>( &'life0 self, topic_name: &'life1 str, topic_type: TypeId, actor: Arc<dyn AnyActor>, ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn publish_any<'life0, 'life1, 'async_trait>( &'life0 self, topic_name: &'life1 str, topic_type: TypeId, message: Arc<dyn Any + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn tx(&self) -> Sender<Event>

Local event processing sender. Agents receive this and emit protocol Events through it. The runtime is responsible for forwarding them to the owning Environment.

Source

fn transport<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn Transport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn take_event_receiver<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<BoxEventStream<Event>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = BoxEventStream<Event>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to runtime protocol events without consuming the receiver.

Source

fn run<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run the runtime event loop and process internal messages until stopped.

Source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request shutdown of the runtime.

Implementors§