Update to rc6. (#155)

* Update to rc6.

* Fix clippy warnings.
This commit is contained in:
David Craven
2020-08-25 10:50:14 +02:00
committed by GitHub
parent eac2ce3b2a
commit 3ea9d3b8bb
11 changed files with 260 additions and 253 deletions
+5 -9
View File
@@ -64,7 +64,6 @@ use sc_service::{
use std::{
future::Future,
pin::Pin,
sync::Arc,
};
use thiserror::Error;
@@ -87,17 +86,16 @@ pub struct SubxtClient {
impl SubxtClient {
/// Create a new client.
pub fn new(mut task_manager: TaskManager, rpc: Arc<RpcHandlers>) -> Self {
pub fn new(mut task_manager: TaskManager, rpc: RpcHandlers) -> Self {
let (to_back, from_front) = mpsc::channel(4);
let (to_front, from_back) = mpsc01::channel(4);
let session = RpcSession::new(to_front.clone());
let session2 = session.clone();
task::spawn(
select(
Box::pin(from_front.for_each(move |message: String| {
let rpc = rpc.clone();
let session = session2.clone();
let session = session.clone();
let mut to_front = to_front.clone().sink_compat();
async move {
let response = rpc.rpc_query(&session, &message).await;
@@ -122,11 +120,9 @@ impl SubxtClient {
/// Creates a new client from a config.
pub fn from_config<C: ChainSpec + 'static>(
config: SubxtClientConfig<C>,
builder: impl Fn(
Configuration,
) -> Result<(TaskManager, Arc<RpcHandlers>), ServiceError>,
builder: impl Fn(Configuration) -> Result<(TaskManager, RpcHandlers), ServiceError>,
) -> Result<Self, ServiceError> {
let config = config.to_service_config();
let config = config.into_service_config();
let (task_manager, rpc_handlers) = (builder)(config)?;
Ok(Self::new(task_manager, rpc_handlers))
}
@@ -224,7 +220,7 @@ pub struct SubxtClientConfig<C: ChainSpec + 'static> {
impl<C: ChainSpec + 'static> SubxtClientConfig<C> {
/// Creates a service configuration.
pub fn to_service_config(self) -> Configuration {
pub fn into_service_config(self) -> Configuration {
let mut network = NetworkConfiguration::new(
format!("{} (subxt client)", self.chain_spec.name()),
"unknown",