From 07198829cfa0f47dccb33d1f385eff701c12b4b3 Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Thu, 6 Oct 2022 16:12:07 -0500 Subject: [PATCH] oops --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 40546bd..0c31acc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -787,18 +787,18 @@ impl Game { /// # use cat_box::play; /// play("/path/to/song.mp3", 15); /// ``` -pub fn play>(path: P, time: u64) -> std::thread::JoinHandle> { +pub fn play + Send + 'static>( + path: P, + time: u64, +) -> std::thread::JoinHandle> { use std::fs::File; use std::io::BufReader; use std::thread; - // bypass the Send + 'static requirement - let p = path.as_ref(); - thread::spawn(move || { let (_stream, stream_handle) = OutputStream::try_default()?; // Load a sound from a file, using a path relative to Cargo.toml - let file = BufReader::new(File::open(p)?); + let file = BufReader::new(File::open(path)?); // Decode that sound file into a source let source = Decoder::new(file)?; // Play the sound directly on the device