From e1b0469b53961008442388c4bf42442f5d17df9b 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 5883199e9..1139512a3 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 89ea214a4..6d08ce492 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 580ab57be..90ac09604 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() {