diff --git a/examples/routeguide-tutorial.md b/examples/routeguide-tutorial.md index e641d27..ffa1bd4 100644 --- a/examples/routeguide-tutorial.md +++ b/examples/routeguide-tutorial.md @@ -447,8 +447,7 @@ async fn record_route( &self, request: Request>, ) -> Result, Status> { - let stream = request.into_inner(); - futures_util::pin_mut!(stream); + let mut stream = request.into_inner(); let mut summary = RouteSummary::default(); let mut last_point = None; @@ -500,11 +499,9 @@ async fn route_chat( request: Request>, ) -> Result, Status> { let mut notes = HashMap::new(); - let stream = request.into_inner(); + let mut stream = request.into_inner(); let output = async_stream::try_stream! { - futures_util::pin_mut!(stream); - while let Some(note) = stream.next().await { let note = note?; diff --git a/examples/src/routeguide/server.rs b/examples/src/routeguide/server.rs index 7760842..4597174 100644 --- a/examples/src/routeguide/server.rs +++ b/examples/src/routeguide/server.rs @@ -68,10 +68,7 @@ impl RouteGuide for RouteGuideService { ) -> Result, Status> { println!("RecordRoute"); - let stream = request.into_inner(); - - // Pin the inbound stream to the stack so that we can call next on it - futures::pin_mut!(stream); + let mut stream = request.into_inner(); let mut summary = RouteSummary::default(); let mut last_point = None; @@ -115,11 +112,9 @@ impl RouteGuide for RouteGuideService { println!("RouteChat"); let mut notes = HashMap::new(); - let stream = request.into_inner(); + let mut stream = request.into_inner(); let output = async_stream::try_stream! { - futures::pin_mut!(stream); - while let Some(note) = stream.next().await { let note = note?; @@ -134,10 +129,7 @@ impl RouteGuide for RouteGuideService { } }; - Ok(Response::new(Box::pin(output) - as Pin< - Box> + Send + Sync + 'static>, - >)) + Ok(Response::new(Box::pin(output) as Self::RouteChatStream)) } }