Merge pull request #678 from sfackler/fix-send
Make postgres::Client Send again
This commit is contained in:
commit
ecc0acbab6
@ -16,14 +16,14 @@ pub struct Connection {
|
||||
runtime: Runtime,
|
||||
connection: Pin<Box<dyn Stream<Item = Result<AsyncMessage, Error>> + Send>>,
|
||||
notifications: VecDeque<Notification>,
|
||||
notice_callback: Arc<dyn Fn(DbError)>,
|
||||
notice_callback: Arc<dyn Fn(DbError) + Sync + Send>,
|
||||
}
|
||||
|
||||
impl Connection {
|
||||
pub fn new<S, T>(
|
||||
runtime: Runtime,
|
||||
connection: tokio_postgres::Connection<S, T>,
|
||||
notice_callback: Arc<dyn Fn(DbError)>,
|
||||
notice_callback: Arc<dyn Fn(DbError) + Sync + Send>,
|
||||
) -> Connection
|
||||
where
|
||||
S: AsyncRead + AsyncWrite + Unpin + 'static + Send,
|
||||
|
@ -499,3 +499,12 @@ fn explicit_close() {
|
||||
let client = Client::connect("host=localhost port=5433 user=postgres", NoTls).unwrap();
|
||||
client.close().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_send() {
|
||||
fn is_send<T: Send>() {}
|
||||
|
||||
is_send::<Client>();
|
||||
is_send::<Statement>();
|
||||
is_send::<Transaction<'_>>();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user