Skip to content

Commit 18d0082

Browse files
authored
Merge pull request #15 from lambdaclass/revert-14-no_clone_required_on_in_msgs
Revert "Removed the requirement of implementing Clone on CallMsg and CastMsg"
2 parents 40f7e0c + 77f62a2 commit 18d0082

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
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: Send + Sized + Sync;
109-
type CastMsg: Send + Sized + Sync;
108+
type CallMsg: Clone + Send + Sized + Sync;
109+
type CastMsg: Clone + 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: 1 addition & 2 deletions
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).await;
30+
let _ = handle.cast(message.clone()).await;
3131
}),
3232
)
3333
.await;
@@ -46,7 +46,6 @@ pub fn send_interval<T>(
4646
) -> TimerHandle
4747
where
4848
T: GenServer + 'static,
49-
T::CastMsg: Clone,
5049
{
5150
let cancellation_token = CancellationToken::new();
5251
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: Send + Sized;
87-
type CastMsg: Send + Sized;
86+
type CallMsg: Clone + Send + Sized;
87+
type CastMsg: Clone + Send + Sized;
8888
type OutMsg: Send + Sized;
8989
type State: Clone + Send;
9090
type Error: Debug;

concurrency/src/threads/time.rs

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

0 commit comments

Comments
 (0)