Add a size_hint to result iterator
This commit is contained in:
parent
c413633fa9
commit
774533e1df
10
src/lib.rs
10
src/lib.rs
@ -1198,6 +1198,16 @@ impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresResult<'stmt> {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (uint, Option<uint>) {
|
||||
let lower = self.data.len();
|
||||
let upper = if self.more_rows {
|
||||
None
|
||||
} else {
|
||||
Some(lower)
|
||||
};
|
||||
(lower, upper)
|
||||
}
|
||||
}
|
||||
|
||||
/// A single result row of a query.
|
||||
|
Loading…
Reference in New Issue
Block a user