This commit is contained in:
Steven Fackler 2019-12-04 18:59:22 -08:00
parent 5c33bf8b30
commit 0c84ed9f82
4 changed files with 8 additions and 26 deletions

View File

@ -384,10 +384,7 @@ impl Client {
/// # Panics /// # Panics
/// ///
/// Panics if the statement contains parameters. /// Panics if the statement contains parameters.
pub async fn copy_in<T, U>( pub async fn copy_in<T, U>(&self, statement: &T) -> Result<CopyInSink<U>, Error>
&self,
statement: &T,
) -> Result<CopyInSink<U>, Error>
where where
T: ?Sized + ToStatement, T: ?Sized + ToStatement,
U: Buf + 'static + Send, U: Buf + 'static + Send,
@ -403,10 +400,7 @@ impl Client {
/// # Panics /// # Panics
/// ///
/// Panics if the statement contains parameters. /// Panics if the statement contains parameters.
pub async fn copy_out<T>( pub async fn copy_out<T>(&self, statement: &T) -> Result<CopyOutStream, Error>
&self,
statement: &T,
) -> Result<CopyOutStream, Error>
where where
T: ?Sized + ToStatement, T: ?Sized + ToStatement,
{ {

View File

@ -1,7 +1,7 @@
use crate::client::{InnerClient, Responses}; use crate::client::{InnerClient, Responses};
use crate::codec::FrontendMessage; use crate::codec::FrontendMessage;
use crate::connection::RequestMessages; use crate::connection::RequestMessages;
use crate::{query, Error, Statement, slice_iter}; use crate::{query, slice_iter, Error, Statement};
use bytes::buf::BufExt; use bytes::buf::BufExt;
use bytes::{Buf, BufMut, BytesMut}; use bytes::{Buf, BufMut, BytesMut};
use futures::channel::mpsc; use futures::channel::mpsc;
@ -195,10 +195,7 @@ where
} }
} }
pub async fn copy_in<T>( pub async fn copy_in<T>(client: &InnerClient, statement: Statement) -> Result<CopyInSink<T>, Error>
client: &InnerClient,
statement: Statement,
) -> Result<CopyInSink<T>, Error>
where where
T: Buf + 'static + Send, T: Buf + 'static + Send,
{ {

View File

@ -1,7 +1,7 @@
use crate::client::{InnerClient, Responses}; use crate::client::{InnerClient, Responses};
use crate::codec::FrontendMessage; use crate::codec::FrontendMessage;
use crate::connection::RequestMessages; use crate::connection::RequestMessages;
use crate::{query, Error, Statement, slice_iter}; use crate::{query, slice_iter, Error, Statement};
use bytes::Bytes; use bytes::Bytes;
use futures::{ready, Stream}; use futures::{ready, Stream};
use pin_project_lite::pin_project; use pin_project_lite::pin_project;
@ -10,10 +10,7 @@ use std::marker::PhantomPinned;
use std::pin::Pin; use std::pin::Pin;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
pub async fn copy_out( pub async fn copy_out(client: &InnerClient, statement: Statement) -> Result<CopyOutStream, Error> {
client: &InnerClient,
statement: Statement,
) -> Result<CopyOutStream, Error> {
let buf = query::encode(client, &statement, slice_iter(&[]))?; let buf = query::encode(client, &statement, slice_iter(&[]))?;
let responses = start(client, buf).await?; let responses = start(client, buf).await?;
Ok(CopyOutStream { Ok(CopyOutStream {

View File

@ -221,10 +221,7 @@ impl<'a> Transaction<'a> {
} }
/// Like `Client::copy_in`. /// Like `Client::copy_in`.
pub async fn copy_in<T, U>( pub async fn copy_in<T, U>(&self, statement: &T) -> Result<CopyInSink<U>, Error>
&self,
statement: &T,
) -> Result<CopyInSink<U>, Error>
where where
T: ?Sized + ToStatement, T: ?Sized + ToStatement,
U: Buf + 'static + Send, U: Buf + 'static + Send,
@ -233,10 +230,7 @@ impl<'a> Transaction<'a> {
} }
/// Like `Client::copy_out`. /// Like `Client::copy_out`.
pub async fn copy_out<T>( pub async fn copy_out<T>(&self, statement: &T) -> Result<CopyOutStream, Error>
&self,
statement: &T,
) -> Result<CopyOutStream, Error>
where where
T: ?Sized + ToStatement, T: ?Sized + ToStatement,
{ {