Skip to content

Commit 756121e

Browse files
committed
cleanup
1 parent 48af741 commit 756121e

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

tokio-postgres/src/impls.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ impl Stream for Query {
121121
}
122122
}
123123

124+
/// The future returned by `Client::execute`.
125+
#[must_use = "futures do nothing unless polled"]
126+
pub struct Execute(pub(crate) proto::ExecuteFuture);
127+
128+
impl Future for Execute {
129+
type Item = u64;
130+
type Error = Error;
131+
132+
fn poll(&mut self) -> Poll<u64, Error> {
133+
self.0.poll()
134+
}
135+
}
136+
124137
/// The future returned by `Client::bind`.
125138
#[must_use = "futures do nothing unless polled"]
126139
pub struct Bind(pub(crate) proto::BindFuture);

tokio-postgres/src/lib.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ impl Client {
182182
/// # Panics
183183
///
184184
/// Panics if the number of parameters provided does not match the number expected.
185-
pub fn execute(&mut self, statement: &Statement, params: &[&dyn ToSql]) -> Execute {
186-
Execute(self.0.execute(&statement.0, params))
185+
pub fn execute(&mut self, statement: &Statement, params: &[&dyn ToSql]) -> impls::Execute {
186+
impls::Execute(self.0.execute(&statement.0, params))
187187
}
188188

189189
/// Executes a statement, returning a stream of the resulting rows.
@@ -396,18 +396,6 @@ impl Statement {
396396
}
397397
}
398398

399-
#[must_use = "futures do nothing unless polled"]
400-
pub struct Execute(proto::ExecuteFuture);
401-
402-
impl Future for Execute {
403-
type Item = u64;
404-
type Error = Error;
405-
406-
fn poll(&mut self) -> Poll<u64, Error> {
407-
self.0.poll()
408-
}
409-
}
410-
411399
/// A portal.
412400
///
413401
/// Portals can only be used with the connection that created them, and only exist for the duration of the transaction
@@ -447,8 +435,13 @@ where
447435
}
448436
}
449437

438+
/// Message returned by the `SimpleQuery` stream.
450439
pub enum SimpleQueryMessage {
440+
/// A row of data.
451441
Row(SimpleQueryRow),
442+
/// A statement in the query has completed.
443+
///
444+
/// The number of rows modified or selected is returned.
452445
CommandComplete(u64),
453446
#[doc(hidden)]
454447
__NonExhaustive,

0 commit comments

Comments
 (0)