From db0c9c41823a3fccaf4daf6146a0631020aee4ae Mon Sep 17 00:00:00 2001 From: Artem Vorotnikov Date: Thu, 29 Aug 2019 19:23:33 +0300 Subject: [PATCH] Cut type_alias_impl_trait feature flag --- tarpc/examples/pubsub.rs | 17 +++++++++-------- tarpc/examples/server_calling_server.rs | 8 +++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tarpc/examples/pubsub.rs b/tarpc/examples/pubsub.rs index a107c6c..03ab920 100644 --- a/tarpc/examples/pubsub.rs +++ b/tarpc/examples/pubsub.rs @@ -4,8 +4,6 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -#![feature(type_alias_impl_trait)] - use futures::{ future::{self, Ready}, prelude::*, @@ -16,6 +14,7 @@ use std::{ collections::HashMap, io, net::SocketAddr, + pin::Pin, sync::{Arc, Mutex}, thread, time::Duration, @@ -87,7 +86,7 @@ impl Publisher { } impl publisher::Publisher for Publisher { - type BroadcastFut = impl Future; + type BroadcastFut = Pin + Send>>; fn broadcast(self, _: context::Context, message: String) -> Self::BroadcastFut { async fn broadcast( @@ -103,10 +102,10 @@ impl publisher::Publisher for Publisher { } } - broadcast(self.clients.clone(), message) + broadcast(self.clients.clone(), message).boxed() } - type SubscribeFut = impl Future>; + type SubscribeFut = Pin> + Send>>; fn subscribe(self, _: context::Context, id: u32, addr: SocketAddr) -> Self::SubscribeFut { async fn subscribe( @@ -122,10 +121,12 @@ impl publisher::Publisher for Publisher { Ok(()) } - subscribe(Arc::clone(&self.clients), id, addr).map_err(|e| e.to_string()) + subscribe(Arc::clone(&self.clients), id, addr) + .map_err(|e| e.to_string()) + .boxed() } - type UnsubscribeFut = impl Future; + type UnsubscribeFut = Pin + Send>>; fn unsubscribe(self, _: context::Context, id: u32) -> Self::UnsubscribeFut { eprintln!("Unsubscribing {}", id); @@ -136,7 +137,7 @@ impl publisher::Publisher for Publisher { id, &*clients ); } - future::ready(()) + future::ready(()).boxed() } } diff --git a/tarpc/examples/server_calling_server.rs b/tarpc/examples/server_calling_server.rs index 9cc1011..b06e87e 100644 --- a/tarpc/examples/server_calling_server.rs +++ b/tarpc/examples/server_calling_server.rs @@ -4,14 +4,12 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -#![feature(type_alias_impl_trait)] - use crate::{add::Add as AddService, double::Double as DoubleService}; use futures::{ future::{self, Ready}, prelude::*, }; -use std::io; +use std::{io, pin::Pin}; use tarpc::{ client, context, server::{Handler, Server}, @@ -50,7 +48,7 @@ struct DoubleServer { } impl DoubleService for DoubleServer { - type DoubleFut = impl Future> + Send; + type DoubleFut = Pin> + Send>>; fn double(self, _: context::Context, x: i32) -> Self::DoubleFut { async fn double(mut client: add::AddClient, x: i32) -> Result { @@ -60,7 +58,7 @@ impl DoubleService for DoubleServer { .map_err(|e| e.to_string()) } - double(self.add_client.clone(), x) + double(self.add_client.clone(), x).boxed() } }