Trait polkadot_node_subsystem_util::reexports::SubsystemContext[][src]

pub trait SubsystemContext: 'static + Send {
    type Message: 'static + Debug + Send;
    type Signal: 'static + Debug + Send;
    type AllMessages: 'static + From<Self::Message> + Send;
    type Sender: 'static + SubsystemSender<Self::AllMessages> + Send;
    type Error: 'static + Error + From<OverseerError> + Sync + Send;
    fn try_recv<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Option<FromOverseer<Self::Message, Self::Signal>>, ()>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn recv<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<FromOverseer<Self::Message, Self::Signal>, Self::Error>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn spawn(
        &mut self,
        name: &'static str,
        s: Pin<Box<dyn Future<Output = ()> + Send + 'static, Global>>
    ) -> Result<(), Self::Error>;
fn spawn_blocking(
        &mut self,
        name: &'static str,
        s: Pin<Box<dyn Future<Output = ()> + Send + 'static, Global>>
    ) -> Result<(), Self::Error>;
fn sender(&mut self) -> &mut Self::Sender; fn send_message<'life0, 'async_trait, X>(
        &'life0 mut self,
        msg: X
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        X: Send + 'async_trait,
        Self: 'async_trait,
        Self::AllMessages: From<X>
, { ... }
fn send_messages<'life0, 'async_trait, X, T>(
        &'life0 mut self,
        msgs: T
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        T: IntoIterator<Item = X> + Send + 'async_trait,
        X: Send + 'async_trait,
        Self: 'async_trait,
        <T as IntoIterator>::IntoIter: Send,
        Self::AllMessages: From<X>
, { ... }
fn send_unbounded_message<X>(&mut self, msg: X)
    where
        X: Send,
        Self::AllMessages: From<X>
, { ... } }
Expand description

A context type that is given to the Subsystem upon spawning. It can be used by Subsystem to communicate with other Subsystems or spawn jobs.

Associated Types

The message type of this context. Subsystems launched with this context will expect to receive messages of this type. Commonly uses the wrapping enum commonly called AllMessages.

And the same for signals.

The overarching all messages enum. In some cases can be identical to Self::Message.

The sender type as provided by sender() and underlying.

The error type.

Required methods

Try to asynchronously receive a message.

This has to be used with caution, if you loop over this without using pending!() macro you will end up with a busy loop!

Receive a message.

Spawn a child task on the executor.

Spawn a blocking child task on the executor’s dedicated thread pool.

Obtain the sender.

Provided methods

Send a direct message to some other Subsystem, routed based on message type.

Send multiple direct messages to other Subsystems, routed based on message type.

Send a message using the unbounded connection.

Implementations on Foreign Types

Implementors