Skip to content

Commit

Permalink
feat: add Send + 'static bounds to Reply trait
Browse files Browse the repository at this point in the history
  • Loading branch information
tqwewe committed May 29, 2024
1 parent bff40dc commit 382a118
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions crates/kameo/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) type BoxReply = Box<dyn any::Any + Send>;
/// The reply type must implement [Reply].
pub trait Message<T>: Send + 'static {
/// The reply sent back to the message caller.
type Reply: Reply + Send + 'static;
type Reply: Reply;

/// Handler for this message.
fn handle(
Expand All @@ -53,7 +53,7 @@ pub trait Message<T>: Send + 'static {
/// The reply type must implement [Reply].
pub trait BlockingMessage<T>: Send + 'static {
/// The reply sent back to the message caller.
type Reply: Reply + Send + 'static;
type Reply: Reply;

/// Handler for this message.
fn handle(&mut self, msg: T, ctx: Context<'_, Self, Self::Reply>) -> Self::Reply;
Expand All @@ -68,7 +68,7 @@ pub trait BlockingMessage<T>: Send + 'static {
/// The reply type must implement [Reply].
pub trait Query<T>: Send + 'static {
/// The reply sent back to the query caller.
type Reply: Reply + Send + 'static;
type Reply: Reply;

/// Handler for this query.
fn handle(
Expand Down
4 changes: 2 additions & 2 deletions crates/kameo/src/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ pub type ForwardedReply<T, M, E = ()> = DelegatedReply<Result<T, SendError<M, E>
/// #[derive(Reply)]
/// pub struct Foo { }
/// ```
pub trait Reply {
pub trait Reply: Send + 'static {
/// The success type in the reply.
type Ok: Send + 'static;
/// The error type in the reply.
type Error: Send + 'static;
/// The type sent back to the receiver.
///
/// In almost all cases this will be `Self`. The only exception is the `DeligatedReply` type.
type Value: Reply + Send + 'static;
type Value: Reply;

/// Converts a reply to a `Result`.
fn to_result(self) -> Result<Self::Ok, Self::Error>;
Expand Down

0 comments on commit 382a118

Please sign in to comment.