Service various cleanups (#3238)

* Remove generic from sign()

* Remove mandatory RuntimeGenesis trait req

* Remove requirement from Configuration

* Relax trait bounds of core/cli

* Move method

* The config field is no longer public

* Remove Components from bounds of functions

* Implement DerefMut for LightComponents

* Implement Executor for Full/LightComponents

* Fix bad merge

* Fix forgotten config()

* Fix build
This commit is contained in:
Pierre Krieger
2019-08-08 16:14:30 +02:00
committed by Gavin Wood
parent fe18b4055d
commit bafc7202ca
8 changed files with 133 additions and 88 deletions
+26
View File
@@ -506,6 +506,16 @@ impl<Factory: ServiceFactory> Future for FullComponents<Factory> {
}
}
impl<Factory: ServiceFactory> Executor<Box<dyn Future<Item = (), Error = ()> + Send>>
for FullComponents<Factory> {
fn execute(
&self,
future: Box<dyn Future<Item = (), Error = ()> + Send>
) -> Result<(), futures::future::ExecuteError<Box<dyn Future<Item = (), Error = ()> + Send>>> {
self.service.execute(future)
}
}
impl<Factory: ServiceFactory> Components for FullComponents<Factory> {
type Factory = Factory;
type Executor = FullExecutor<Factory>;
@@ -606,6 +616,12 @@ impl<Factory: ServiceFactory> Deref for LightComponents<Factory> {
}
}
impl<Factory: ServiceFactory> DerefMut for LightComponents<Factory> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.service
}
}
impl<Factory: ServiceFactory> Future for LightComponents<Factory> {
type Item = ();
type Error = ();
@@ -615,6 +631,16 @@ impl<Factory: ServiceFactory> Future for LightComponents<Factory> {
}
}
impl<Factory: ServiceFactory> Executor<Box<dyn Future<Item = (), Error = ()> + Send>>
for LightComponents<Factory> {
fn execute(
&self,
future: Box<dyn Future<Item = (), Error = ()> + Send>
) -> Result<(), futures::future::ExecuteError<Box<dyn Future<Item = (), Error = ()> + Send>>> {
self.service.execute(future)
}
}
impl<Factory: ServiceFactory> Components for LightComponents<Factory> {
type Factory = Factory;
type Executor = LightExecutor<Factory>;