*: implement ExactSizeIterator where possible
This commit is contained in:
@ -191,4 +191,12 @@ impl<'a> Iterator for SideDataIter<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).side_data_elems as usize, Some((*self.ptr).side_data_elems as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for SideDataIter<'a> { }
|
||||
|
@ -118,8 +118,16 @@ impl<'a> Iterator for RectIter<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).num_rects as usize, Some((*self.ptr).num_rects as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for RectIter<'a> { }
|
||||
|
||||
pub enum Rect<'a> {
|
||||
None,
|
||||
Bitmap(Bitmap<'a>),
|
||||
|
@ -66,4 +66,12 @@ impl<'a> Iterator for DeviceIter<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).nb_devices as usize, Some((*self.ptr).nb_devices as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for DeviceIter<'a> { }
|
||||
|
@ -216,8 +216,16 @@ impl<'a> Iterator for StreamIter<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).nb_streams as usize, Some((*self.ptr).nb_streams as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for StreamIter<'a> { }
|
||||
|
||||
pub struct StreamIterMut<'a> {
|
||||
ptr: *const AVFormatContext,
|
||||
cur: c_uint,
|
||||
@ -245,8 +253,16 @@ impl<'a> Iterator for StreamIterMut<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).nb_streams as usize, Some((*self.ptr).nb_streams as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for StreamIterMut<'a> { }
|
||||
|
||||
pub struct PacketIter<'a> {
|
||||
context: &'a mut Context,
|
||||
}
|
||||
|
@ -113,4 +113,12 @@ impl<'a> Iterator for SideDataIter<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
unsafe {
|
||||
((*self.ptr).nb_side_data as usize, Some((*self.ptr).nb_side_data as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for SideDataIter<'a> { }
|
||||
|
Reference in New Issue
Block a user