mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 17:21:08 +00:00
Exit signal gets its own trait (#433)
* Exit signal gets its own trait * Typo * Removed clone bounds
This commit is contained in:
@@ -38,11 +38,9 @@ mod vergen {
|
||||
|
||||
// the regular polkadot worker simply does nothing until ctrl-c
|
||||
struct Worker;
|
||||
impl cli::Worker for Worker {
|
||||
type Work = Self::Exit;
|
||||
impl cli::IntoExit for Worker {
|
||||
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
|
||||
|
||||
fn exit_only(&self) -> Self::Exit {
|
||||
fn into_exit(self) -> Self::Exit {
|
||||
// can't use signal directly here because CtrlC takes only `Fn`.
|
||||
let (exit_send, exit) = oneshot::channel();
|
||||
|
||||
@@ -55,9 +53,13 @@ impl cli::Worker for Worker {
|
||||
|
||||
exit.map_err(drop)
|
||||
}
|
||||
}
|
||||
|
||||
fn work<C: ServiceComponents>(self, _service: &Service<C>) -> Self::Exit {
|
||||
self.exit_only()
|
||||
impl cli::Worker for Worker {
|
||||
type Work = <Self as cli::IntoExit>::Exit;
|
||||
fn work<C: ServiceComponents>(self, _service: &Service<C>) -> Self::Work {
|
||||
use cli::IntoExit;
|
||||
self.into_exit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user