crb_runtime

Trait Runtime

Source
pub trait Runtime:
    Sized
    + Send
    + 'static {
    type Context: Context;

    // Required methods
    fn get_interruptor(&mut self) -> Box<dyn Interruptor>;
    fn routine<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Failures> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn context(&self) -> &Self::Context;

    // Provided method
    fn entrypoint<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait { ... }
}
Expand description

A runtime that can be executed by a supervisor.

Required Associated Types§

Source

type Context: Context

Type of the composable block’s contenxt.

Required Methods§

Source

fn get_interruptor(&mut self) -> Box<dyn Interruptor>

Used by a lifetime tracker of the supervisor to stop it. It’s the separate type that wraps address made by a runtime.

Source

fn routine<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Failures> + Send + 'async_trait>>
where Self: 'async_trait,

Interruptor can interrupt this routine.

The notifier is passed by a reference to fully avoid cloning or passing it somewhere to let it outlive this trackable object.

Source

fn context(&self) -> &Self::Context

Gets a reference to a context.

Provided Methods§

Source

fn entrypoint<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,

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§