@@ -45,7 +45,7 @@ use crate::{Middleware, Request, Response};
4545///
4646/// Tide routes will also accept endpoints with `Fn` signatures of this form, but using the `async` keyword has better ergonomics.
4747#[ async_trait]
48- pub trait Endpoint < State : Send + Sync + ' static > : Send + Sync + ' static {
48+ pub trait Endpoint < State : Clone + Send + Sync + ' static > : Send + Sync + ' static {
4949 /// Invoke the endpoint within the given context
5050 async fn call ( & self , req : Request < State > ) -> crate :: Result ;
5151}
@@ -55,7 +55,7 @@ pub(crate) type DynEndpoint<State> = dyn Endpoint<State>;
5555#[ async_trait]
5656impl < State , F , Fut , Res > Endpoint < State > for F
5757where
58- State : Send + Sync + ' static ,
58+ State : Clone + Send + Sync + ' static ,
5959 F : Send + Sync + ' static + Fn ( Request < State > ) -> Fut ,
6060 Fut : Future < Output = Result < Res > > + Send + ' static ,
6161 Res : Into < Response > + ' static ,
@@ -93,7 +93,7 @@ impl<E, State> std::fmt::Debug for MiddlewareEndpoint<E, State> {
9393
9494impl < E , State > MiddlewareEndpoint < E , State >
9595where
96- State : Send + Sync + ' static ,
96+ State : Clone + Send + Sync + ' static ,
9797 E : Endpoint < State > ,
9898{
9999 pub fn wrap_with_middleware ( ep : E , middleware : & [ Arc < dyn Middleware < State > > ] ) -> Self {
@@ -107,7 +107,7 @@ where
107107#[ async_trait]
108108impl < E , State > Endpoint < State > for MiddlewareEndpoint < E , State >
109109where
110- State : Send + Sync + ' static ,
110+ State : Clone + Send + Sync + ' static ,
111111 E : Endpoint < State > ,
112112{
113113 async fn call ( & self , req : Request < State > ) -> crate :: Result {
0 commit comments