diff --git a/concurrency/src/tasks/gen_server.rs b/concurrency/src/tasks/gen_server.rs index 7c6d01d..a72a52a 100644 --- a/concurrency/src/tasks/gen_server.rs +++ b/concurrency/src/tasks/gen_server.rs @@ -105,8 +105,8 @@ pub trait GenServer where Self: Send + Sized, { - type CallMsg: Send + Sized + Sync; - type CastMsg: Send + Sized + Sync; + type CallMsg: Clone + Send + Sized + Sync; + type CastMsg: Clone + Send + Sized + Sync; type OutMsg: Send + Sized; type State: Clone + Send; type Error: Debug + Send; diff --git a/concurrency/src/tasks/time.rs b/concurrency/src/tasks/time.rs index 691bf3f..f26118b 100644 --- a/concurrency/src/tasks/time.rs +++ b/concurrency/src/tasks/time.rs @@ -27,7 +27,7 @@ where Box::pin(cloned_token.cancelled()), Box::pin(async { rt::sleep(period).await; - let _ = handle.cast(message).await; + let _ = handle.cast(message.clone()).await; }), ) .await; @@ -46,7 +46,6 @@ pub fn send_interval( ) -> TimerHandle where T: GenServer + 'static, - T::CastMsg: Clone, { let cancellation_token = CancellationToken::new(); let cloned_token = cancellation_token.clone(); diff --git a/concurrency/src/threads/gen_server.rs b/concurrency/src/threads/gen_server.rs index 912067b..9d58754 100644 --- a/concurrency/src/threads/gen_server.rs +++ b/concurrency/src/threads/gen_server.rs @@ -83,8 +83,8 @@ pub trait GenServer where Self: Send + Sized, { - type CallMsg: Send + Sized; - type CastMsg: Send + Sized; + type CallMsg: Clone + Send + Sized; + type CastMsg: Clone + Send + Sized; type OutMsg: Send + Sized; type State: Clone + Send; type Error: Debug; diff --git a/concurrency/src/threads/time.rs b/concurrency/src/threads/time.rs index 2819bbe..3d47c05 100644 --- a/concurrency/src/threads/time.rs +++ b/concurrency/src/threads/time.rs @@ -41,7 +41,6 @@ pub fn send_interval( ) -> TimerHandle where T: GenServer + 'static, - T::CastMsg: Clone, { let cancellation_token = CancellationToken::new(); let mut cloned_token = cancellation_token.clone();