Skip to content

Commit

Permalink
Removing the todo and addressing clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
iluvcapra committed Dec 10, 2024
1 parent 08789de commit 8cc8c6e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/source/channel_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ where

struct ChannelRouterMessage(usize, usize, f32);

/// `ChannelRouterController::map()` returns this error if the router source has been dropped.
pub struct ChannelRouterControllerError {}

/// A controller type that sends gain updates to a corresponding [`ChannelRouterSource`].
#[derive(Debug, Clone)]
pub struct ChannelRouterController {
Expand All @@ -55,10 +58,20 @@ impl ChannelRouterController {
///
/// Successive calls to `mix` with the same `from` and `to` arguments will replace the
/// previous gain value with the new one.
pub fn map(&mut self, from: u16, to: u16, gain: f32) {
if self.sender.send(ChannelRouterMessage(from as usize, to as usize, gain)).is_err()
pub fn map(
&mut self,
from: u16,
to: u16,
gain: f32,
) -> Result<(), ChannelRouterControllerError> {
if self
.sender
.send(ChannelRouterMessage(from as usize, to as usize, gain))
.is_err()
{
todo!("Probably shouldn't panic here");
Err(ChannelRouterControllerError {})
} else {
Ok(())
}
}
}
Expand Down

0 comments on commit 8cc8c6e

Please sign in to comment.