Skip to content

Commit 31fd45c

Browse files
committed
Removed the requirement of implementing Clone on CallMsg and CastMsg
1 parent 481439d commit 31fd45c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

concurrency/src/tasks/gen_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ pub trait GenServer
105105
where
106106
Self: Send + Sized,
107107
{
108-
type CallMsg: Clone + Send + Sized + Sync;
109-
type CastMsg: Clone + Send + Sized + Sync;
108+
type CallMsg: Send + Sized + Sync;
109+
type CastMsg: Send + Sized + Sync;
110110
type OutMsg: Send + Sized;
111111
type State: Clone + Send;
112112
type Error: Debug + Send;

concurrency/src/tasks/time.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ where
2727
Box::pin(cloned_token.cancelled()),
2828
Box::pin(async {
2929
rt::sleep(period).await;
30-
let _ = handle.cast(message.clone()).await;
30+
let _ = handle.cast(message).await;
3131
}),
3232
)
3333
.await;
@@ -46,6 +46,7 @@ pub fn send_interval<T>(
4646
) -> TimerHandle
4747
where
4848
T: GenServer + 'static,
49+
T::CastMsg: Clone,
4950
{
5051
let cancellation_token = CancellationToken::new();
5152
let cloned_token = cancellation_token.clone();

concurrency/src/threads/gen_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ pub trait GenServer
8383
where
8484
Self: Send + Sized,
8585
{
86-
type CallMsg: Clone + Send + Sized;
87-
type CastMsg: Clone + Send + Sized;
86+
type CallMsg: Send + Sized;
87+
type CastMsg: Send + Sized;
8888
type OutMsg: Send + Sized;
8989
type State: Clone + Send;
9090
type Error: Debug;

concurrency/src/threads/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub fn send_interval<T>(
4141
) -> TimerHandle
4242
where
4343
T: GenServer + 'static,
44+
T::CastMsg: Clone,
4445
{
4546
let cancellation_token = CancellationToken::new();
4647
let mut cloned_token = cancellation_token.clone();

0 commit comments

Comments
 (0)