@@ -8,7 +8,7 @@ use std::borrow::Cow;
8
8
use bytes:: BytesMut ;
9
9
use bytes:: BufMut ;
10
10
11
- use futures:: { future, Future , BoxFuture } ;
11
+ use futures:: { future, Future } ;
12
12
13
13
use tokio_proto:: pipeline:: ServerProto ;
14
14
use tokio_service:: Service ;
@@ -40,7 +40,7 @@ pub struct Error {
40
40
}
41
41
42
42
impl From < serde_json:: Error > for Error {
43
- fn from ( e : serde_json:: Error ) -> Self {
43
+ fn from ( _e : serde_json:: Error ) -> Self {
44
44
Error {
45
45
error : "UnknownError" . into ( ) ,
46
46
..Default :: default ( )
@@ -177,19 +177,19 @@ impl Service for VarlinkService {
177
177
type Error = io:: Error ;
178
178
179
179
// The future for computing the response; box it for simplicity.
180
- type Future = BoxFuture < Self :: Response , Self :: Error > ;
180
+ type Future = Box < Future < Item = Self :: Response , Error = Self :: Error > + Send > ;
181
181
182
182
// Produce a future for computing a response from a request.
183
183
fn call ( & self , req : Self :: Request ) -> Self :: Future {
184
184
185
185
println ! ( "Request: {}" , serde_json:: to_string( & req) . unwrap( ) ) ;
186
186
let n: usize = match req. method . rfind ( '.' ) {
187
187
None => {
188
- return future:: ok ( Response :: Err ( Error {
188
+ return Box :: new ( future:: ok ( Response :: Err ( Error {
189
189
error : "InterfaceNotFound" . into ( ) ,
190
190
parameters : Some ( json ! ( { "interface" : req. method} ) ) ,
191
191
..Default :: default ( )
192
- } ) ) . boxed ( )
192
+ } ) ) )
193
193
}
194
194
Some ( x) => x,
195
195
} ;
@@ -199,24 +199,24 @@ impl Service for VarlinkService {
199
199
match iface. as_ref ( ) {
200
200
"org.varlink.service" => {
201
201
match self :: Interface :: call ( self , req) {
202
- Ok ( val) => future:: ok ( Response :: Ok ( Reply { parameters : Some ( val) } ) ) . boxed ( ) ,
203
- Err ( e) => future:: ok ( Response :: Err ( e) ) . boxed ( ) ,
202
+ Ok ( val) => Box :: new ( future:: ok ( Response :: Ok ( Reply { parameters : Some ( val) } ) ) ) ,
203
+ Err ( e) => Box :: new ( future:: ok ( Response :: Err ( e) ) )
204
204
}
205
205
}
206
206
key => {
207
207
if self . ifaces . contains_key ( key) {
208
208
match self . ifaces [ key] . call ( req) {
209
209
Ok ( val) => {
210
- future:: ok ( Response :: Ok ( Reply { parameters : Some ( val) } ) ) . boxed ( )
210
+ Box :: new ( future:: ok ( Response :: Ok ( Reply { parameters : Some ( val) } ) ) )
211
211
}
212
- Err ( e) => future:: ok ( Response :: Err ( e) ) . boxed ( ) ,
212
+ Err ( e) => Box :: new ( future:: ok ( Response :: Err ( e) ) ) ,
213
213
}
214
214
} else {
215
- future:: ok ( Response :: Err ( Error {
215
+ Box :: new ( future:: ok ( Response :: Err ( Error {
216
216
error : "InterfaceNotFound" . into ( ) ,
217
217
parameters : Some ( json ! ( { "interface" : key} ) ) ,
218
218
..Default :: default ( )
219
- } ) ) . boxed ( )
219
+ } ) ) )
220
220
}
221
221
}
222
222
0 commit comments