diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-07 10:47:42 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-07 10:47:42 -0700 |
commit | b8bb816d72217c1afdb18858481db737e52a4e7f (patch) | |
tree | 96664eb8a38e7c435e2c2e8a3432cc55118d7bd2 /src/basic_actors.rs | |
parent | d5083f4cce47567644fd1b2c5923e5d0dcd98d44 (diff) | |
download | hope-b8bb816d72217c1afdb18858481db737e52a4e7f.tar.gz hope-b8bb816d72217c1afdb18858481db737e52a4e7f.zip |
don't waste time blocking for no reason
Diffstat (limited to 'src/basic_actors.rs')
-rw-r--r-- | src/basic_actors.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/basic_actors.rs b/src/basic_actors.rs index 130c1e2..6418694 100644 --- a/src/basic_actors.rs +++ b/src/basic_actors.rs @@ -26,7 +26,7 @@ impl Actorful for Constant { let value = self.value.clone(); Box::new(move || { loop { - output_channels["Value"].send(value.clone()).unwrap() + let _ = output_channels["Value"].try_send(value.clone()); } }) } @@ -58,7 +58,7 @@ impl Actorful for Add { Box::new(move || { for (n1, n2) in n1.iter().zip(n2.iter()) { if let (Value::Number(n1), Value::Number(n2)) = (n1, n2) { - output_channels["Result"].send(Value::Number(n1 + n2)).unwrap(); + let _ = output_channels["Result"].try_send(Value::Number(n1 + n2)); } } }) @@ -97,11 +97,9 @@ impl Actorful for RepeatValue { Box::new(move || { for (value, count) in value.iter().zip(count.iter()) { if let Value::Number(count) = count { - // TODO figure out what a smart thing to do would be here instead - // this API design is deliberately suboptimal because i'd like to not do it let count: usize = count.try_into().unwrap(); let vec = vec![value; count]; - output_channels["List"].send(Value::List(vec)).unwrap(); + let _ = output_channels["List"].try_send(Value::List(vec)); } } }) @@ -137,7 +135,7 @@ impl Actorful for DeconstructRecord { for record in record.iter() { if let Value::Record(fields) = record { for (label, value) in fields { - output_channels[&label].send(value).unwrap(); + let _ = output_channels[&label].try_send(value); } } } |