Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lambda-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub trait Handler<'a>: Sized {
/// The type of Future this Handler will return
type Fut: Future<Output = Result<Self::Response, Self::Error>> + 'a;
/// Function used to execute handler behavior
fn call(&self, event: Request, context: Context) -> Self::Fut;
fn call(&mut self, event: Request, context: Context) -> Self::Fut;
}

/// Adapts a [`Handler`](trait.Handler.html) to the `lambda_runtime::run` interface
Expand All @@ -117,7 +117,7 @@ where
type Response = R;
type Error = Error;
type Fut = Fut;
fn call(&self, event: Request, context: Context) -> Self::Fut {
fn call(&mut self, event: Request, context: Context) -> Self::Fut {
(self)(event, context)
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<'a, H: Handler<'a>> Handler<'a> for Adapter<'a, H> {
type Response = H::Response;
type Error = H::Error;
type Fut = H::Fut;
fn call(&self, event: Request, context: Context) -> Self::Fut {
fn call(&mut self, event: Request, context: Context) -> Self::Fut {
self.handler.call(event, context)
}
}
Expand All @@ -168,7 +168,7 @@ impl<'a, H: Handler<'a>> LambdaHandler<LambdaRequest<'a>, LambdaResponse> for Ad
type Error = H::Error;
type Fut = TransformResponse<'a, H::Response, Self::Error>;

fn call(&self, event: LambdaRequest<'_>, context: Context) -> Self::Fut {
fn call(&mut self, event: LambdaRequest<'_>, context: Context) -> Self::Fut {
let request_origin = event.request_origin();
let fut = Box::pin(self.handler.call(event.into(), context));
TransformResponse { request_origin, fut }
Expand Down
6 changes: 3 additions & 3 deletions lambda-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub trait Handler<A, B> {
/// Response of this handler.
type Fut: Future<Output = Result<B, Self::Error>>;
/// Handle the incoming event.
fn call(&self, event: A, context: Context) -> Self::Fut;
fn call(&mut self, event: A, context: Context) -> Self::Fut;
}

/// Returns a new [`HandlerFn`] with the given closure.
Expand All @@ -101,7 +101,7 @@ where
{
type Error = Error;
type Fut = Fut;
fn call(&self, req: A, ctx: Context) -> Self::Fut {
fn call(&mut self, req: A, ctx: Context) -> Self::Fut {
(self.f)(req, ctx)
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ where
pub async fn run<F, A, B>(
&self,
incoming: impl Stream<Item = Result<http::Response<hyper::Body>, Error>> + Send,
handler: F,
mut handler: F,
config: &Config,
) -> Result<(), Error>
where
Expand Down