@@ -40,6 +40,10 @@ impl ResultSetMeta {
4040}
4141
4242/// Result of a query or statement execution.
43+ ///
44+ /// Represents an asyncronous query result, that may not be fully consumed. Note,
45+ /// that unconsumed query results are dropped implicitly when corresponding connection
46+ /// is dropped or queried.
4347#[ derive( Debug ) ]
4448pub struct QueryResult < ' a , ' t : ' a , P > {
4549 conn : Connection < ' a , ' t > ,
@@ -59,17 +63,15 @@ where
5963
6064 /// Returns `true` if this query result may contain rows.
6165 ///
62- /// If `false` then there is no rows possible (e.g. result of an UPDATE query).
66+ /// If `false` then no rows possible for this query tesult (e.g. result of an UPDATE query).
6367 fn has_rows ( & self ) -> bool {
6468 self . conn
6569 . get_pending_result ( )
6670 . and_then ( |meta| meta. columns ( ) . map ( |columns| columns. len ( ) > 0 ) . ok ( ) )
6771 . unwrap_or ( false )
6872 }
6973
70- /// `true` if there is no more rows nor result sets in this query.
71- ///
72- /// One could use it to check if there is more than one result set in this query result.
74+ /// `true` if there are no more rows nor result sets in this query.
7375 pub fn is_empty ( & self ) -> bool {
7476 !self . has_rows ( ) && !self . conn . more_results_exists ( )
7577 }
@@ -137,22 +139,22 @@ where
137139 self . conn . last_insert_id ( )
138140 }
139141
140- /// Number of affected rows, as reported by the server, or `0`.
142+ /// Number of affected rows as reported by the server, or `0`.
141143 pub fn affected_rows ( & self ) -> u64 {
142144 self . conn . affected_rows ( )
143145 }
144146
145- /// Text information, as reported by the server, or an empty string.
147+ /// Text information as reported by the server, or an empty string.
146148 pub fn info ( & self ) -> Cow < ' _ , str > {
147149 self . conn . info ( )
148150 }
149151
150- /// Number of warnings, as reported by the server, or `0`.
152+ /// Number of warnings as reported by the server, or `0`.
151153 pub fn warnings ( & self ) -> u16 {
152154 self . conn . get_warnings ( )
153155 }
154156
155- /// Returns a future that collects result set of this query result.
157+ /// Collects the current result set of this query result.
156158 ///
157159 /// It is parametrized by `R` and internally calls `R::from_row(Row)` on each row.
158160 ///
@@ -177,7 +179,7 @@ where
177179 . await
178180 }
179181
180- /// Returns a future that collects result set of this query result.
182+ /// Collects the current result set of this query result.
181183 ///
182184 /// It works the same way as [`QueryResult::collect`] but won't panic if row isn't convertible
183185 /// to `R`.
@@ -192,8 +194,7 @@ where
192194 . await
193195 }
194196
195- /// Returns a future that collects the current result set of this query result and drops
196- /// everything else.
197+ /// Collects the current result set of this query result and drops everything else.
197198 ///
198199 /// # Panic
199200 ///
@@ -209,8 +210,7 @@ where
209210 Ok ( output)
210211 }
211212
212- /// Returns a future that collects the current result set of this query result and drops
213- /// everything else.
213+ /// Collects the current result set of this query result and drops everything else.
214214 ///
215215 /// It works the same way as [`QueryResult::collect_and_drop`] but won't panic if row isn't
216216 /// convertible to `R`.
@@ -223,7 +223,7 @@ where
223223 Ok ( output)
224224 }
225225
226- /// Returns a future that will execute `fun` on every row of the current result set.
226+ /// Executes `fun` on every row of the current result set.
227227 ///
228228 /// It will stop on the nearest result set boundary (see `QueryResult::collect` docs).
229229 pub async fn for_each < F > ( & mut self , mut fun : F ) -> Result < ( ) >
@@ -240,8 +240,7 @@ where
240240 }
241241 }
242242
243- /// Returns a future that will execute `fun` on every row of the current result set and drop
244- /// everything else.
243+ /// Executes `fun` on every row of the current result set and drops everything else.
245244 pub async fn for_each_and_drop < F > ( mut self , fun : F ) -> Result < ( ) >
246245 where
247246 F : FnMut ( Row ) ,
@@ -251,7 +250,7 @@ where
251250 Ok ( ( ) )
252251 }
253252
254- /// Returns a future that will map every row of the current result set to `U` using `fun`.
253+ /// Maps every row of the current result set to `U` using `fun`.
255254 ///
256255 /// It will stop on the nearest result set boundary (see `QueryResult::collect` docs).
257256 pub async fn map < F , U > ( & mut self , mut fun : F ) -> Result < Vec < U > >
@@ -265,8 +264,7 @@ where
265264 Ok ( acc)
266265 }
267266
268- /// Returns a future that will map every row of the current result set to `U` using `fun`
269- /// and drop everything else.
267+ /// Map every row of the current result set to `U` using `fun` and drops everything else.
270268 pub async fn map_and_drop < F , U > ( mut self , fun : F ) -> Result < Vec < U > >
271269 where
272270 F : FnMut ( Row ) -> U ,
@@ -276,7 +274,7 @@ where
276274 Ok ( rows)
277275 }
278276
279- /// Returns a future that will reduce rows of the current result set to `U` using `fun`.
277+ /// Reduces rows of the current result set to `U` using `fun`.
280278 ///
281279 /// It will stop on the nearest result set boundary (see `QueryResult::collect` docs).
282280 pub async fn reduce < T , F , U > ( & mut self , mut init : U , mut fun : F ) -> Result < U >
@@ -290,8 +288,7 @@ where
290288 Ok ( init)
291289 }
292290
293- /// Returns a future that will reduce rows of the current result set to `U` using `fun` and drop
294- /// everything else.
291+ /// Reduces rows of the current result set to `U` using `fun` and drops everything else.
295292 pub async fn reduce_and_drop < T , F , U > ( mut self , init : U , fun : F ) -> Result < U >
296293 where
297294 F : FnMut ( U , T ) -> U ,
@@ -302,7 +299,7 @@ where
302299 Ok ( acc)
303300 }
304301
305- /// Returns a future that will drop this query result.
302+ /// Drops this query result.
306303 pub async fn drop_result ( mut self ) -> Result < ( ) > {
307304 loop {
308305 while let Some ( _) = self . next ( ) . await ? { }
@@ -314,7 +311,7 @@ where
314311
315312 /// Returns a reference to a columns list of this query result.
316313 ///
317- /// Empty list means, that this result set was never meant to contain rows.
314+ /// Empty list means that this result set was never meant to contain rows.
318315 pub fn columns_ref ( & self ) -> & [ Column ] {
319316 self . conn
320317 . get_pending_result ( )
0 commit comments