Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix size_hint implementations in driver iterators #1332

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ when upgrading from a version of rust-sdl2 to another.

[PR #1318](https://github.com/Rust-SDL2/rust-sdl2/pull/1318) Add NV12, NV21 to PixelFormatEnum

[PR #1332](https://github.com/Rust-SDL2/rust-sdl2/pull/1332) Fix `size_hint` implementations for `{audio,video,render}::DriverIterator`

### v0.35.2

[PR #1173](https://github.com/Rust-SDL2/rust-sdl2/pull/1173) Fix segfault when using timer callbacks
Expand Down
4 changes: 2 additions & 2 deletions src/sdl2/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ impl Iterator for DriverIterator {

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let l = self.length as usize;
(l, Some(l))
let remaining = (self.length - self.index) as usize;
(remaining, Some(remaining))
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/sdl2/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2576,8 +2576,8 @@ impl Iterator for DriverIterator {

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let l = self.length as usize;
(l, Some(l))
let remaining = (self.length - self.index) as usize;
(remaining, Some(remaining))
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/sdl2/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2012,8 +2012,8 @@ impl Iterator for DriverIterator {

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let l = self.length as usize;
(l, Some(l))
let remaining = (self.length - self.index) as usize;
(remaining, Some(remaining))
}
}

Expand Down