Trait polkadot_overseer_gen::SubsystemContext [−][src]
pub trait SubsystemContext: Send + 'static {
type Message: Debug + Send + 'static;
type Signal: Debug + Send + 'static;
type AllMessages: From<Self::Message> + Send + 'static;
type Sender: SubsystemSender<Self::AllMessages> + Send + 'static;
type Error: Error + From<OverseerError> + Sync + Send + 'static;
fn try_recv<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<FromOverseer<Self::Message, Self::Signal>>, ()>> + Send + 'async_trait>>
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>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn spawn(
&mut self,
name: &'static str,
s: Pin<Box<dyn Future<Output = ()> + Send>>
) -> Result<(), Self::Error>;
fn spawn_blocking(
&mut self,
name: &'static str,
s: Pin<Box<dyn Future<Output = ()> + Send>>
) -> 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>>
where
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn send_messages<'life0, 'async_trait, X, T>(
&'life0 mut self,
msgs: T
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
T: IntoIterator<Item = X> + Send,
T::IntoIter: Send,
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn send_unbounded_message<X>(&mut self, msg: X)
where
Self::AllMessages: From<X>,
X: Send,
{ ... }
}
Expand description
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
.
type AllMessages: From<Self::Message> + Send + 'static
type AllMessages: From<Self::Message> + Send + 'static
The overarching all messages enum
.
In some cases can be identical to Self::Message
.
type Sender: SubsystemSender<Self::AllMessages> + Send + 'static
type Sender: SubsystemSender<Self::AllMessages> + Send + 'static
The sender type as provided by sender()
and underlying.
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.
Provided methods
fn send_message<'life0, 'async_trait, X>(
&'life0 mut self,
msg: X
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn send_message<'life0, 'async_trait, X>(
&'life0 mut self,
msg: X
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Send a direct message to some other Subsystem
, routed based on message type.
fn send_messages<'life0, 'async_trait, X, T>(
&'life0 mut self,
msgs: T
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
T: IntoIterator<Item = X> + Send,
T::IntoIter: Send,
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn send_messages<'life0, 'async_trait, X, T>(
&'life0 mut self,
msgs: T
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
T: IntoIterator<Item = X> + Send,
T::IntoIter: Send,
Self::AllMessages: From<X>,
X: Send,
X: 'async_trait,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Send multiple direct messages to other Subsystem
s, routed based on message type.
fn send_unbounded_message<X>(&mut self, msg: X) where
Self::AllMessages: From<X>,
X: Send,
fn send_unbounded_message<X>(&mut self, msg: X) where
Self::AllMessages: From<X>,
X: Send,
Send a message using the unbounded connection.