From 00491369de5f0c8ff3e41f1503e51688dd02b585 Mon Sep 17 00:00:00 2001 From: Rodrigo Navarro Date: Tue, 28 Jan 2025 19:17:11 -0300 Subject: [PATCH] Fixing doc tests --- examples/expect-continue.rs | 2 +- src/server.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/expect-continue.rs b/examples/expect-continue.rs index 0e36cad..65d8a05 100644 --- a/examples/expect-continue.rs +++ b/examples/expect-continue.rs @@ -19,7 +19,7 @@ impl Service for UploadService { .unwrap()) } - fn should_continue(&self, req: &Request) -> StatusCode { + fn should_continue(&mut self, req: &Request) -> StatusCode { match req.headers().typed_get::() { Some(len) if len.0 <= self.max_length => StatusCode::CONTINUE, _ => StatusCode::EXPECTATION_FAILED, diff --git a/src/server.rs b/src/server.rs index d4235a8..f485b2e 100644 --- a/src/server.rs +++ b/src/server.rs @@ -72,14 +72,14 @@ type IncomingRequest = Request; /// type Body = &'static str; /// type Error = Infallible; /// -/// fn call(&self, _req: Request) -> Result, Self::Error> { +/// fn call(&mut self, _req: Request) -> Result, Self::Error> { /// Ok(Response::builder() /// .status(StatusCode::OK) /// .body("Thanks for the info!") /// .unwrap()) /// } /// -/// fn should_continue(&self, req: &Request) -> StatusCode { +/// fn should_continue(&mut self, req: &Request) -> StatusCode { /// match req.headers().typed_get::() { /// Some(len) if len.0 <= self.max_length => StatusCode::CONTINUE, /// _ => StatusCode::EXPECTATION_FAILED, @@ -97,7 +97,7 @@ pub trait Service { fn call(&mut self, request: IncomingRequest) -> Result, Self::Error>; - fn should_continue(&self, _: &IncomingRequest) -> StatusCode { + fn should_continue(&mut self, _: &IncomingRequest) -> StatusCode { StatusCode::CONTINUE } }