fill_buffer

This commit is contained in:
Paul Masurel
2017-06-14 23:32:58 +09:00
parent 09e27740e2
commit 4fe96483bc

View File

@@ -52,16 +52,16 @@ pub trait DocSet {
}
}
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> bool {
for buffer_val in buffer.iter_mut() {
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize {
for (i, buffer_val) in buffer.iter_mut().enumerate() {
if self.advance() {
*buffer_val = self.doc();
}
else {
return false;
return i;
}
}
return true;
return buffer.len();
}
/// Returns the current document