Skip to content

Commit 9e901d4

Browse files
authored
service: Improve unsized types' support (#650)
… and fix missing ready call in example.
1 parent d21cdbf commit 9e901d4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tower-service/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ use core::task::{Context, Poll};
9999
/// As an example, here is how a Redis request would be issued:
100100
///
101101
/// ```rust,ignore
102-
/// let client = redis::Client::new()
102+
/// let mut client = redis::Client::new()
103103
/// .connect("127.0.0.1:6379".parse().unwrap())
104104
/// .unwrap();
105105
///
106+
/// ServiceExt::<Cmd>::ready(&mut client).await?;
107+
///
106108
/// let resp = client.call(Cmd::set("foo", "this is the value of foo")).await?;
107109
///
108-
/// // Wait for the future to resolve
109110
/// println!("Redis response: {:?}", resp);
110111
/// ```
111112
///
@@ -363,9 +364,9 @@ pub trait Service<Request> {
363364
fn call(&mut self, req: Request) -> Self::Future;
364365
}
365366

366-
impl<'a, S, Request> Service<Request> for &'a mut S
367+
impl<S, Request> Service<Request> for &mut S
367368
where
368-
S: Service<Request> + 'a,
369+
S: Service<Request> + ?Sized,
369370
{
370371
type Response = S::Response;
371372
type Error = S::Error;

0 commit comments

Comments
 (0)