From 3b623557c147ecc504f432704ececcae2ebf5c2d Mon Sep 17 00:00:00 2001 From: jazzfool Date: Sun, 20 Oct 2024 14:40:05 +1100 Subject: [PATCH] thumbnails: accept iterator --- src/video.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/video.rs b/src/video.rs index b6232c5..ba227ca 100644 --- a/src/video.rs +++ b/src/video.rs @@ -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, Error> { + pub fn thumbnails(&mut self, positions: I) -> Result, Error> + where + I: IntoIterator, + { 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) {