Skip to content

Commit 54e52bd

Browse files
authored
Merge pull request #477 from jebrosen/prepare-send
Make prepare() return a Future that satisfies `Send`.
2 parents ac8d707 + 98fb117 commit 54e52bd

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tokio-postgres/src/prepare.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ async fn get_type(client: &Arc<InnerClient>, oid: Oid) -> Result<Type, Error> {
126126

127127
let stmt = typeinfo_statement(client).await?;
128128

129-
let params: &[&dyn ToSql] = &[&oid];
130-
let buf = query::encode(&stmt, params.iter().cloned());
129+
let buf = query::encode(&stmt, (&[&oid as &dyn ToSql]).iter().cloned());
131130
let rows = query::query(client.clone(), stmt, buf);
132131
pin_mut!(rows);
133132

@@ -174,7 +173,7 @@ async fn get_type(client: &Arc<InnerClient>, oid: Oid) -> Result<Type, Error> {
174173
fn get_type_rec<'a>(
175174
client: &'a Arc<InnerClient>,
176175
oid: Oid,
177-
) -> Pin<Box<dyn Future<Output = Result<Type, Error>> + 'a>> {
176+
) -> Pin<Box<dyn Future<Output = Result<Type, Error>> + Send + 'a>> {
178177
Box::pin(get_type(client, oid))
179178
}
180179

@@ -198,8 +197,7 @@ async fn typeinfo_statement(client: &Arc<InnerClient>) -> Result<Statement, Erro
198197
async fn get_enum_variants(client: &Arc<InnerClient>, oid: Oid) -> Result<Vec<String>, Error> {
199198
let stmt = typeinfo_enum_statement(client).await?;
200199

201-
let params: &[&dyn ToSql] = &[&oid];
202-
let buf = query::encode(&stmt, params.iter().cloned());
200+
let buf = query::encode(&stmt, (&[&oid as &dyn ToSql]).iter().cloned());
203201
query::query(client.clone(), stmt, buf)
204202
.and_then(|row| future::ready(row.try_get(0)))
205203
.try_collect()
@@ -226,8 +224,7 @@ async fn typeinfo_enum_statement(client: &Arc<InnerClient>) -> Result<Statement,
226224
async fn get_composite_fields(client: &Arc<InnerClient>, oid: Oid) -> Result<Vec<Field>, Error> {
227225
let stmt = typeinfo_composite_statement(client).await?;
228226

229-
let params: &[&dyn ToSql] = &[&oid];
230-
let buf = query::encode(&stmt, params.iter().cloned());
227+
let buf = query::encode(&stmt, (&[&oid as &dyn ToSql]).iter().cloned());
231228
let rows = query::query(client.clone(), stmt, buf)
232229
.try_collect::<Vec<_>>()
233230
.await?;

0 commit comments

Comments
 (0)