Skip to content

Commit 774533e

Browse files
committed
Add a size_hint to result iterator
1 parent c413633 commit 774533e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,16 @@ impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresResult<'stmt> {
11981198
}
11991199
})
12001200
}
1201+
1202+
fn size_hint(&self) -> (uint, Option<uint>) {
1203+
let lower = self.data.len();
1204+
let upper = if self.more_rows {
1205+
None
1206+
} else {
1207+
Some(lower)
1208+
};
1209+
(lower, upper)
1210+
}
12011211
}
12021212

12031213
/// A single result row of a query.

0 commit comments

Comments
 (0)