Skip to content

Commit

Permalink
Tracks: Remove box around TrackState (#84)
Browse files Browse the repository at this point in the history
Boxing is unnecessary since `TrackState` implements copy.

Tested using `cargo make ready`.
  • Loading branch information
vilgotf authored and FelixMcFelix committed Jul 1, 2021
1 parent 210e3ae commit 91d7542
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/tracks/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub enum TrackCommand {
AddEvent(EventData),
/// Run some closure on this track, with direct access to the core object.
Do(Box<dyn FnOnce(&mut Track) + Send + Sync + 'static>),
/// Request a read-only view of this track's state.
Request(Sender<Box<TrackState>>),
/// Request a copy of this track's state.
Request(Sender<TrackState>),
/// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/tracks/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl TrackHandle {
}

/// 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);
self.send(TrackCommand::Request(tx))?;

Expand Down
2 changes: 1 addition & 1 deletion src/tracks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 91d7542

Please sign in to comment.