diff options
-rw-r--r-- | src/actor.rs | 2 | ||||
-rw-r--r-- | src/basic_actors.rs | 10 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/world.rs | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/src/actor.rs b/src/actor.rs index 12e351f..dd62729 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -112,7 +112,7 @@ impl Actorful for ProgrammableActor { }; thread::spawn(move || { for val in source.iter() { - dest.send(val).unwrap() + let _ = dest.try_send(val); } }); } 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); } } } diff --git a/src/main.rs b/src/main.rs index 8617d6a..ef61de7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -112,7 +112,7 @@ fn main() { ("X".to_string(), actor::Value::Number(number::Number::from(mouse_x))), ("Y".to_string(), actor::Value::Number(number::Number::from(mouse_y))), ]); - mouse_position.send(value).unwrap(); + let _ = mouse_position.try_send(value); } if let Ok(value) = screen_buffer.try_recv() { diff --git a/src/world.rs b/src/world.rs index 1fbc4fe..a3260a2 100644 --- a/src/world.rs +++ b/src/world.rs @@ -6,7 +6,7 @@ use uuid::Uuid; use crate::actor::{Actorful, Value, Slot}; -const CHANNEL_SIZE: usize = 5; +const CHANNEL_SIZE: usize = 1; pub struct ActorThreadId(Uuid); |