Skip to content

Commit

Permalink
chore(tonic): Replace futures_util::pin_mut with tokio::pin
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Aug 9, 2023
1 parent 37b99fb commit 36d13f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tonic/src/client/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<T> Grpc<T> {
let (mut parts, body, extensions) =
self.streaming(request, path, codec).await?.into_parts();

futures_util::pin_mut!(body);
tokio::pin!(body);

let message = body
.try_next()
Expand Down
6 changes: 3 additions & 3 deletions tonic/src/codec/prost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ mod tests {
None,
);

futures_util::pin_mut!(body);
tokio::pin!(body);

while let Some(r) = body.data().await {
r.unwrap();
Expand All @@ -189,7 +189,7 @@ mod tests {
Some(MAX_MESSAGE_SIZE),
);

futures_util::pin_mut!(body);
tokio::pin!(body);

assert!(body.data().await.is_none());
assert_eq!(
Expand Down Expand Up @@ -223,7 +223,7 @@ mod tests {
Some(usize::MAX),
);

futures_util::pin_mut!(body);
tokio::pin!(body);

assert!(body.data().await.is_none());
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion tonic/src/server/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ where
self.max_decoding_message_size,
);

futures_util::pin_mut!(stream);
tokio::pin!(stream);

let message = stream
.try_next()
Expand Down
4 changes: 2 additions & 2 deletions tonic/src/transport/server/incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where
IE: Into<crate::Error>,
{
async_stream::try_stream! {
futures_util::pin_mut!(incoming);
tokio::pin!(incoming);

while let Some(item) = incoming.next().await {
yield item.map(ServerIo::new_io)?
Expand All @@ -44,7 +44,7 @@ where
IE: Into<crate::Error>,
{
async_stream::try_stream! {
futures_util::pin_mut!(incoming);
tokio::pin!(incoming);

let mut tasks = tokio::task::JoinSet::new();

Expand Down

0 comments on commit 36d13f4

Please sign in to comment.