diff options
| author | Fuwn <[email protected]> | 2023-04-03 02:44:25 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-03 02:44:25 +0000 |
| commit | ed52d304178d5d37a0af710f06e8fe8eb65b2c24 (patch) | |
| tree | a1ce35c6a54d576361a6378c3cf59ea60ebc15e1 /src/response | |
| parent | feat(response): allow multiple languages (diff) | |
| download | windmark-ed52d304178d5d37a0af710f06e8fe8eb65b2c24.tar.xz windmark-ed52d304178d5d37a0af710f06e8fe8eb65b2c24.zip | |
feat(router): GET RID OF DIRTY BOXES
Diffstat (limited to 'src/response')
| -rw-r--r-- | src/response/macros.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/response/macros.rs b/src/response/macros.rs index f49da2d..54e6a8b 100644 --- a/src/response/macros.rs +++ b/src/response/macros.rs @@ -23,10 +23,10 @@ macro_rules! response { #[macro_export] macro_rules! $name { ($body:expr /* $(,)? */) => { - ::std::boxed::Box::new(|_| windmark::Response::$name($body)) + |_: ::windmark::returnable::RouteContext<'_>| ::windmark::Response::$name($body) }; ($context:ident, $body:expr /* $(,)? */) => { - ::std::boxed::Box::new(|$context| windmark::Response::$name($body)) + |$context: ::windmark::returnable::RouteContext<'_>| ::windmark::Response::$name($body) }; } )* @@ -57,9 +57,9 @@ response!(certificate_not_valid); #[macro_export] macro_rules! binary_success { ($body:expr, $mime:expr) => { - ::std::boxed::Box::new(|_| { + |_: ::windmark::returnable::RouteContext<'_>| { ::windmark::Response::binary_success($body, $mime) - }) + } }; ($body:expr) => {{ #[cfg(not(feature = "auto-deduce-mime"))] @@ -68,19 +68,19 @@ macro_rules! binary_success { feature to be enabled" ); - ::std::boxed::Box::new(|_| { + |_: ::windmark::returnable::RouteContext<'_>| { #[cfg(feature = "auto-deduce-mime")] return ::windmark::Response::binary_success_auto($body); // Suppress item not found warning #[cfg(not(feature = "auto-deduce-mime"))] ::windmark::Response::binary_success($body, "application/octet-stream") - }) + } }}; ($context:ident, $body:expr, $mime:expr) => { - ::std::boxed::Box::new(|$context| { + |$context: ::windmark::returnable::RouteContext<'_>| { ::windmark::Response::binary_success($body, $mime) - }) + } }; ($context:ident, $body:expr) => {{ #[cfg(not(feature = "auto-deduce-mime"))] @@ -89,13 +89,13 @@ macro_rules! binary_success { feature to be enabled" ); - ::std::boxed::Box::new(|$context| { + |$context: ::windmark::returnable::RouteContext<'_>| { #[cfg(feature = "auto-deduce-mime")] return ::windmark::Response::binary_success_auto($body); // Suppress item not found warning #[cfg(not(feature = "auto-deduce-mime"))] ::windmark::Response::binary_success($body, "application/octet-stream") - }) + } }}; } |