Tracks: Remove box around TrackState (#84)

Boxing is unnecessary since `TrackState` implements copy.

Tested using `cargo make ready`.
This commit is contained in:
Vilgot Fredenberg
2021-06-29 15:58:21 +02:00
committed by Kyle Simpson
parent 210e3ae584
commit 91d7542593
3 changed files with 4 additions and 4 deletions

View File

@@ -26,8 +26,8 @@ pub enum TrackCommand {
AddEvent(EventData), AddEvent(EventData),
/// Run some closure on this track, with direct access to the core object. /// Run some closure on this track, with direct access to the core object.
Do(Box<dyn FnOnce(&mut Track) + Send + Sync + 'static>), Do(Box<dyn FnOnce(&mut Track) + Send + Sync + 'static>),
/// Request a read-only view of this track's state. /// Request a copy of this track's state.
Request(Sender<Box<TrackState>>), Request(Sender<TrackState>),
/// Change the loop count/strategy of this track. /// Change the loop count/strategy of this track.
Loop(LoopState), Loop(LoopState),
/// Prompts a track's input to become live and usable, if it is not already. /// Prompts a track's input to become live and usable, if it is not already.

View File

@@ -162,7 +162,7 @@ impl TrackHandle {
} }
/// Request playback information and state from the audio context. /// Request playback information and state from the audio context.
pub async fn get_info(&self) -> TrackResult<Box<TrackState>> { pub async fn get_info(&self) -> TrackResult<TrackState> {
let (tx, rx) = flume::bounded(1); let (tx, rx) = flume::bounded(1);
self.send(TrackCommand::Request(tx))?; self.send(TrackCommand::Request(tx))?;

View File

@@ -294,7 +294,7 @@ impl Track {
)); ));
}, },
Request(tx) => { Request(tx) => {
let _ = tx.send(Box::new(self.state())); let _ = tx.send(self.state());
}, },
Loop(loops) => Loop(loops) =>
if self.set_loops(loops).is_ok() { if self.set_loops(loops).is_ok() {