Fix issue when calling `buffer.samples()` multiple times with the same buffer
This commit is contained in:
parent
6becac9780
commit
5c6fa4384f
|
@ -36,7 +36,7 @@ pub struct Buffer<'a, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterator over the samples of the buffer.
|
/// Iterator over the samples of the buffer.
|
||||||
pub struct SamplesIter<'a, 'b, T: 'b>(&'b mut uint, std::slice::MutItems<'b, T>);
|
pub struct SamplesIter<'a, 'b, T: 'b>(&'b mut uint, std::iter::Skip<std::slice::MutItems<'b, T>>);
|
||||||
|
|
||||||
struct RequiredConversion<T> {
|
struct RequiredConversion<T> {
|
||||||
intermediate_buffer: Vec<T>,
|
intermediate_buffer: Vec<T>,
|
||||||
|
@ -177,6 +177,8 @@ impl<'a, T> Buffer<'a, T> {
|
||||||
self.target.as_mut().unwrap().get_buffer().iter_mut()
|
self.target.as_mut().unwrap().get_buffer().iter_mut()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let iter = iter.skip(self.elements_written);
|
||||||
|
|
||||||
SamplesIter(&mut self.elements_written, iter)
|
SamplesIter(&mut self.elements_written, iter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue