Derive From for AllMessages and simplify send_msg (#1774)

This commit is contained in:
Bastian Köcher
2020-10-01 18:22:15 +02:00
committed by GitHub
parent 579614d127
commit 5d8ae8d024
4 changed files with 41 additions and 41 deletions
+2 -2
View File
@@ -192,8 +192,8 @@ impl OverseerHandler {
}
/// Send some message to one of the `Subsystem`s.
pub async fn send_msg(&mut self, msg: AllMessages) -> SubsystemResult<()> {
self.events_tx.send(Event::MsgToSubsystem(msg)).await.map_err(Into::into)
pub async fn send_msg(&mut self, msg: impl Into<AllMessages>) -> SubsystemResult<()> {
self.events_tx.send(Event::MsgToSubsystem(msg.into())).await.map_err(Into::into)
}
/// Inform the `Overseer` that that some block was finalized.
+1 -1
View File
@@ -7,7 +7,7 @@ description = "Subsystem traits and message definitions"
[dependencies]
async-trait = "0.1"
derive_more = "0.99.9"
derive_more = "0.99.11"
futures = "0.3.5"
futures-timer = "3.0.2"
log = "0.4.8"
+1 -1
View File
@@ -519,7 +519,7 @@ impl CollationGenerationMessage {
}
/// A message type tying together all message types that are used across Subsystems.
#[derive(Debug)]
#[derive(Debug, derive_more::From)]
pub enum AllMessages {
/// Message for the validation subsystem.
CandidateValidation(CandidateValidationMessage),