From 91d754259381e709e0768cbf089dbb67ef84680e Mon Sep 17 00:00:00 2001 From: Vilgot Fredenberg Date: Tue, 29 Jun 2021 15:58:21 +0200 Subject: [PATCH] Tracks: Remove box around TrackState (#84) Boxing is unnecessary since `TrackState` implements copy. Tested using `cargo make ready`. --- src/tracks/command.rs | 4 ++-- src/tracks/handle.rs | 2 +- src/tracks/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tracks/command.rs b/src/tracks/command.rs index 5883199..1139512 100644 --- a/src/tracks/command.rs +++ b/src/tracks/command.rs @@ -26,8 +26,8 @@ pub enum TrackCommand { AddEvent(EventData), /// Run some closure on this track, with direct access to the core object. Do(Box), - /// Request a read-only view of this track's state. - Request(Sender>), + /// Request a copy of this track's state. + Request(Sender), /// Change the loop count/strategy of this track. Loop(LoopState), /// Prompts a track's input to become live and usable, if it is not already. diff --git a/src/tracks/handle.rs b/src/tracks/handle.rs index 89ea214..6d08ce4 100644 --- a/src/tracks/handle.rs +++ b/src/tracks/handle.rs @@ -162,7 +162,7 @@ impl TrackHandle { } /// Request playback information and state from the audio context. - pub async fn get_info(&self) -> TrackResult> { + pub async fn get_info(&self) -> TrackResult { let (tx, rx) = flume::bounded(1); self.send(TrackCommand::Request(tx))?; diff --git a/src/tracks/mod.rs b/src/tracks/mod.rs index 580ab57..90ac096 100644 --- a/src/tracks/mod.rs +++ b/src/tracks/mod.rs @@ -294,7 +294,7 @@ impl Track { )); }, Request(tx) => { - let _ = tx.send(Box::new(self.state())); + let _ = tx.send(self.state()); }, Loop(loops) => if self.set_loops(loops).is_ok() {