thumbnails: accept iterator

This commit is contained in:
jazzfool 2024-10-20 14:40:05 +11:00
parent 2c55d14dbe
commit 3b623557c1

View file

@ -482,7 +482,10 @@ impl Video {
///
/// Slow; only needs to be called once for each instance.
/// It's best to call this at the very start of playback, otherwise the position may shift.
pub fn thumbnails(&mut self, positions: &[Position]) -> Result<Vec<img::Handle>, Error> {
pub fn thumbnails<I>(&mut self, positions: I) -> Result<Vec<img::Handle>, Error>
where
I: IntoIterator<Item = Position>,
{
let paused = self.paused();
let muted = self.muted();
let pos = self.position();
@ -495,8 +498,8 @@ impl Video {
let width = inner.width;
let height = inner.height;
positions
.iter()
.map(|&pos| {
.into_iter()
.map(|pos| {
inner.seek(pos, true)?;
inner.upload_frame.store(false, Ordering::SeqCst);
while !inner.upload_frame.load(Ordering::SeqCst) {