diff options
| author | Fuwn <[email protected]> | 2023-03-30 10:40:04 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-30 10:40:04 +0000 |
| commit | 7182bbfbe4a79c6fe980a8323cb9e0b5d0a79f91 (patch) | |
| tree | 8a4ffb75c7b367fdcab305664553a836f651cef4 | |
| parent | feat: overhaul response system (diff) | |
| download | windmark-7182bbfbe4a79c6fe980a8323cb9e0b5d0a79f91.tar.xz windmark-7182bbfbe4a79c6fe980a8323cb9e0b5d0a79f91.zip | |
docs: fix old response documentation
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | src/router.rs | 14 |
2 files changed, 9 insertions, 9 deletions
@@ -41,9 +41,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { windmark::Router::new() .set_private_key_file("windmark_private.pem") .set_certificate_file("windmark_public.pem") - .mount("/", Box::new(|_| Response::Success("Hello, World!".into()))) + .mount("/", Box::new(|_| Response::success("Hello, World!"))) .set_error_handler(Box::new(|_| { - Response::PermanentFailure("This route does not exist!".into()) + Response::permanent_failure("This route does not exist!") })) .run() .await diff --git a/src/router.rs b/src/router.rs index e1e7a11..0f8a82c 100644 --- a/src/router.rs +++ b/src/router.rs @@ -125,11 +125,11 @@ impl Router { /// windmark::Router::new() /// .mount( /// "/", - /// Box::new(|_| Response::Success("This is the index page!".into())), + /// Box::new(|_| Response::success("This is the index page!")), /// ) /// .mount( /// "/test", - /// Box::new(|_| Response::Success("This is a test page!".into())), + /// Box::new(|_| Response::success("This is a test page!")), /// ); /// ``` /// @@ -151,7 +151,7 @@ impl Router { /// /// ```rust /// windmark::Router::new().set_error_handler(Box::new(|_| { - /// windmark::Response::Success("You have encountered an error!".into()) + /// windmark::Response::success("You have encountered an error!") /// })); /// ``` pub fn set_error_handler(&mut self, handler: ErrorResponse) -> &mut Self { @@ -587,11 +587,11 @@ impl Router { /// windmark::Router::new().attach_stateless(|r| { /// r.mount( /// "/module", - /// Box::new(|_| Response::Success("This is a module!".into())), + /// Box::new(|_| Response::success("This is a module!")), /// ); /// r.set_error_handler(Box::new(|_| { - /// Response::NotFound( - /// "This error handler has been implemented by a module!".into(), + /// Response::not_found( + /// "This error handler has been implemented by a module!", /// ) /// })); /// }); @@ -606,7 +606,7 @@ impl Router { /// pub fn module(router: &mut windmark::Router) { /// router.mount( /// "/module", - /// Box::new(|_| windmark::Response::Success("This is a module!".into())), + /// Box::new(|_| windmark::Response::success("This is a module!")), /// ); /// } /// } |