chore(docs): Remove unecessary pinning (#263)

This commit is contained in:
Dizans
2020-02-13 11:34:34 -05:00
committed by GitHub
parent 3e63e05666
commit 34865a9fb5
2 changed files with 5 additions and 16 deletions
+2 -5
View File
@@ -447,8 +447,7 @@ async fn record_route(
&self,
request: Request<tonic::Streaming<Point>>,
) -> Result<Response<RouteSummary>, 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<tonic::Streaming<RouteNote>>,
) -> Result<Response<Self::RouteChatStream>, 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?;
+3 -11
View File
@@ -68,10 +68,7 @@ impl RouteGuide for RouteGuideService {
) -> Result<Response<RouteSummary>, 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<dyn Stream<Item = Result<RouteNote, Status>> + Send + Sync + 'static>,
>))
Ok(Response::new(Box::pin(output) as Self::RouteChatStream))
}
}