cros-codecs icon indicating copy to clipboard operation
cros-codecs copied to clipboard

Can't iterate over ReadyFramesQueue<T> without consuming it

Open dwlsalmeida opened this issue 1 year ago • 0 comments

The actual code does not seem to match the docs:

/// Allows us to manipulate the frames list like an iterator without consuming it and resetting its
/// display order counter.
impl<'a, T> Iterator for &'a mut ReadyFramesQueue<T> {
    type Item = T;

    /// Returns the next frame (if any) waiting to be dequeued.
    fn next(&mut self) -> Option<T> {
        self.queue.pop_front()
    }
}

iter_mut() calls pop_front(), so it is actually not possible to iterate without removing items

dwlsalmeida avatar Nov 20 '23 15:11 dwlsalmeida