Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaca0f77

Browse files
committed
implement Stream for Responses
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
1 parentf3ab8b9 commitaca0f77

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎tokio-postgres/src/client.rs‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ use crate::{
1717
use bytes::{Buf,BytesMut};
1818
use fallible_iterator::FallibleIterator;
1919
use futures::channel::mpsc;
20-
use futures::{future, pin_mut, ready,StreamExt,TryStreamExt};
20+
use futures::{future, pin_mut, ready,Stream,StreamExt,TryStreamExt};
2121
use parking_lot::Mutex;
2222
use postgres_protocol::message::backend::Message;
2323
use postgres_types::BorrowToSql;
2424
use std::collections::HashMap;
2525
use std::fmt;
26+
use std::pin::Pin;
2627
use std::sync::Arc;
2728
use std::task::{Context,Poll};
2829
use std::time::Duration;
@@ -54,6 +55,17 @@ impl Responses {
5455
}
5556
}
5657

58+
implStreamforResponses{
59+
typeItem =Result<Message,Error>;
60+
61+
fnpoll_next(mutself:Pin<&mutSelf>,cx:&mutContext<'_>) ->Poll<Option<Self::Item>>{
62+
matchready!((*self).poll_next(cx)){
63+
Err(err)if err.is_closed() =>Poll::Ready(None),
64+
msg =>Poll::Ready(Some(msg)),
65+
}
66+
}
67+
}
68+
5769
/// A cache of type info and prepared statements for fetching type info
5870
/// (corresponding to the queries in the [prepare](prepare) module).
5971
#[derive(Default)]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp