aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-04-16 01:19:24 +0000
committerFuwn <[email protected]>2023-04-16 01:19:24 +0000
commit8cf440914cb2d28d6df1fd23472f422be57d1947 (patch)
tree6bbdf130ac4f4429c6501538c6b60e6a25c0b470
parentrefactor(hooks): implement call for hooks (diff)
downloadwindmark-0.3.5.tar.xz
windmark-0.3.5.zip
feat: improve macro hygienev0.3.5
-rw-r--r--Cargo.toml2
-rw-r--r--README.md8
-rw-r--r--src/response/macros.rs28
3 files changed, 19 insertions, 19 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 8d1c4fb..9f5bade 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "windmark"
-version = "0.3.4"
+version = "0.3.5"
authors = ["Fuwn <[email protected]>"]
edition = "2021"
description = "An elegant and highly performant async Gemini server framework"
diff --git a/README.md b/README.md
index 3313b8f..a01b597 100644
--- a/README.md
+++ b/README.md
@@ -18,18 +18,18 @@ Check out an example starter project
# Cargo.toml
[dependencies]
-windmark = "0.3.4"
+windmark = "0.3.5"
tokio = { version = "1.26.0", features = ["full"] }
# If you would like to use the built-in logger (recommended)
-# windmark = { version = "0.3.4", features = ["logger"] }
+# windmark = { version = "0.3.5", features = ["logger"] }
# If you would like to use the built-in MIME dedection when `Success`-ing a file
# (recommended)
-# windmark = { version = "0.3.4", features = ["auto-deduce-mime"] }
+# windmark = { version = "0.3.5", features = ["auto-deduce-mime"] }
# If you would like to use macro-based responses (as seen below)
-# windmark = { version = "0.3.4", features = ["response-macros"] }
+# windmark = { version = "0.3.5", features = ["response-macros"] }
```
### Implement a Windmark server
diff --git a/src/response/macros.rs b/src/response/macros.rs
index 1d13c8f..10f6b06 100644
--- a/src/response/macros.rs
+++ b/src/response/macros.rs
@@ -23,10 +23,10 @@ macro_rules! sync_response {
#[macro_export]
macro_rules! $name {
($body:expr /* $(,)? */) => {
- |_: ::windmark::context::RouteContext| ::windmark::Response::$name($body)
+ |_: $crate::context::RouteContext| $crate::Response::$name($body)
};
($context:ident, $body:expr /* $(,)? */) => {
- |$context: ::windmark::context::RouteContext| ::windmark::Response::$name($body)
+ |$context: $crate::context::RouteContext| $crate::Response::$name($body)
};
}
)*
@@ -40,10 +40,10 @@ macro_rules! async_response {
#[macro_export]
macro_rules! [< $name _async >] {
($body:expr /* $(,)? */) => {
- |_: ::windmark::context::RouteContext| async { ::windmark::Response::$name($body) }
+ |_: $crate::context::RouteContext| async { $crate::Response::$name($body) }
};
($context:ident, $body:expr /* $(,)? */) => {
- |$context: ::windmark::context::RouteContext| async { ::windmark::Response::$name($body) }
+ |$context: $crate::context::RouteContext| async { $crate::Response::$name($body) }
};
}
})*
@@ -86,8 +86,8 @@ response!(binary_success_auto);
#[macro_export]
macro_rules! binary_success {
($body:expr, $mime:expr) => {
- |_: ::windmark::context::RouteContext| {
- ::windmark::Response::binary_success($body, $mime)
+ |_: $crate::context::RouteContext| {
+ $crate::Response::binary_success($body, $mime)
}
};
($body:expr) => {{
@@ -97,18 +97,18 @@ macro_rules! binary_success {
feature to be enabled"
);
- |_: ::windmark::context::RouteContext| {
+ |_: $crate::context::RouteContext| {
#[cfg(feature = "auto-deduce-mime")]
- return ::windmark::Response::binary_success_auto($body);
+ return $crate::Response::binary_success_auto($body);
// Suppress item not found warning
#[cfg(not(feature = "auto-deduce-mime"))]
- ::windmark::Response::binary_success($body, "application/octet-stream")
+ $crate::Response::binary_success($body, "application/octet-stream")
}
}};
($context:ident, $body:expr, $mime:expr) => {
- |$context: ::windmark::context::RouteContext| {
- ::windmark::Response::binary_success($body, $mime)
+ |$context: $crate::context::RouteContext| {
+ $crate::Response::binary_success($body, $mime)
}
};
($context:ident, $body:expr) => {{
@@ -118,13 +118,13 @@ macro_rules! binary_success {
feature to be enabled"
);
- |$context: ::windmark::context::RouteContext| {
+ |$context: $crate::context::RouteContext| {
#[cfg(feature = "auto-deduce-mime")]
- return ::windmark::Response::binary_success_auto($body);
+ return $crate::Response::binary_success_auto($body);
// Suppress item not found warning
#[cfg(not(feature = "auto-deduce-mime"))]
- ::windmark::Response::binary_success($body, "application/octet-stream")
+ $crate::Response::binary_success($body, "application/octet-stream")
}
}};
}