Implement ExactSizeIterator for the buffer adapter
This commit is contained in:
parent
2486368d08
commit
c4b983baf8
|
@ -92,8 +92,15 @@ impl<'outer, 'inner> Iterator for Samples<'outer, 'inner> {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let remaining = self.buffers[0].len() - self.current_sample;
|
||||
(remaining, Some(remaining))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'outer, 'inner> ExactSizeIterator for Samples<'outer, 'inner> {}
|
||||
|
||||
/// An iterator over the channel data for a sample, yielded by [Samples].
|
||||
pub struct Channels<'outer, 'inner> {
|
||||
/// The raw output buffers.
|
||||
|
@ -124,4 +131,11 @@ impl<'outer, 'inner> Iterator for Channels<'outer, 'inner> {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let remaining = self.buffers0.len() - self.current_channel;
|
||||
(remaining, Some(remaining))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'outer, 'inner> ExactSizeIterator for Channels<'outer, 'inner> {}
|
||||
|
|
Loading…
Reference in a new issue