Skip to content

Commit 8b93622

Browse files
committed
Refactor: Rename "tracing" feature to "trace" and update dependencies for compatibility
- Replaced occurrences of `feature = "tracing"` with `feature = "trace"`. - Updated associated comments, imports, attributes, and configurations. - Resolved Code consistency and adjusted dependency versions to align with the new feature name.
1 parent c420174 commit 8b93622

File tree

20 files changed

+114
-153
lines changed

20 files changed

+114
-153
lines changed

Cargo.toml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
workspace = { members = ["code-gen"] }
1+
workspace = { members = ["axum-resp-result-macro"] }
22

33
[package]
44
name = "axum-resp-result"
5-
version = "0.7.1"
5+
version = "0.8.0"
66
edition = "2021"
77
authors = ["FrozenString<[email protected]>"]
88
description = "Help Struct For Axum Response"
@@ -17,51 +17,48 @@ rustdoc-args = ["--cfg", "docsrs"]
1717

1818
[[example]]
1919
name = "axum"
20-
required-features = ["tracing"]
20+
required-features = ["trace", "extra-error"]
2121

2222
[[example]]
23-
name="expand"
24-
required-features = ["tracing"]
23+
name = "expand"
24+
required-features = ["trace"]
2525

2626

2727
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2828
[features]
29-
log = ["tracing", "trace?/log"]
30-
tracing = ["dep:trace", "dep:tracing-unwrap"]
29+
log = ["trace", "tracing?/log"]
30+
trace = ["dep:tracing", "dep:tracing-unwrap"]
3131
extra-error = ["axum-resp-result-macro/extra-error"]
3232
nightly_try_v2 = []
3333

3434
[dependencies]
3535
serde_json = "1"
3636
http = "1"
3737
once_cell = "1"
38-
thiserror = "1.0.37"
39-
trace = { version = "0.1.37", package = "tracing", optional = true }
40-
tracing-unwrap = { version = "0.10.0", features = [
38+
thiserror = "2.0.12"
39+
tracing = { version = "0.1.37", optional = true }
40+
tracing-unwrap = { version = "1.0.1", features = [
4141
"log-location",
4242
], optional = true }
43-
futures = "0.3"
44-
axum-resp-result-macro = { version = "0.7.1" }
43+
axum-resp-result-macro = { path = "./axum-resp-result-macro" }
4544

4645
[dependencies.serde]
4746
version = "1"
4847
features = ["derive"]
4948

5049
[dependencies.axum]
51-
version = "0.7"
50+
version = "0.8"
5251

5352
[dependencies.mime]
5453
version = "0.3"
5554

5655
[dev-dependencies]
5756
serde_json = "1"
5857
tokio = { version = "1", features = ["full"] }
59-
simple-log = "1.6.0"
6058
tracing-subscriber = { version = "0.3.16", features = [
6159
"fmt",
6260
"registry",
6361
"env-filter",
6462
] }
65-
tower = { version = "0.4.13", features = ["tracing"] }
66-
tower-http = { version = "0.5", features = ["trace"] }
67-
thiserror = "1.0.37"
63+
tower-http = { version = "0.6.6", features = ["trace"] }
64+
thiserror = "2.0.12"

code-gen/Cargo.toml renamed to axum-resp-result-macro/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "axum-resp-result-macro"
3-
version = "0.7.1"
3+
version = "0.8.0"
44
edition = "2021"
55
authors = ["FrozenString<[email protected]>"]
66
description = "Help Struct For Axum Response"
@@ -14,7 +14,7 @@ proc-macro = true
1414

1515

1616
[features]
17-
extra-error=[]
17+
extra-error = []
1818
[dependencies]
1919
darling = "0.20"
2020
proc-macro2 = "1"
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
mod derive_resp_error;
22
mod proc_resp_result;
3+
use proc_resp_result::Function;
34
use quote::quote;
4-
use syn::spanned::Spanned;
5-
use syn::{parse_macro_input, DeriveInput};
5+
use syn::{parse_macro_input, spanned::Spanned, DeriveInput};
66

77
use crate::derive_resp_error::gen_resp_error_derive;
8-
use proc_resp_result::Function;
98

109
/// convert a return [Result] [`Handler`](axum::Handler) return [`RespResult`]
1110
#[proc_macro_attribute]
1211
pub fn resp_result(
13-
_: proc_macro::TokenStream,
14-
input: proc_macro::TokenStream,
12+
_: proc_macro::TokenStream, input: proc_macro::TokenStream,
1513
) -> proc_macro::TokenStream {
1614
let func = syn::parse_macro_input!(input as Function);
1715
quote!(#func).into()
1816
}
1917

2018
#[proc_macro_derive(RespError, attributes(resp_result))]
21-
pub fn derive_resp_error(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
19+
pub fn derive_resp_error(
20+
input: proc_macro::TokenStream,
21+
) -> proc_macro::TokenStream {
2222
let input = parse_macro_input!(input as DeriveInput);
23-
if cfg!(feature = "extra-err") {
23+
if cfg!(feature = "extra-error") {
2424
return syn::Error::new(
2525
input.span(),
2626
"Derive macro `RespError` not support `extra-message` yet",
2727
)
2828
.into_compile_error()
2929
.into();
3030
}
31-
let token_stream = gen_resp_error_derive(&input).unwrap_or_else(|err| err.into_compile_error());
31+
let token_stream = gen_resp_error_derive(&input)
32+
.unwrap_or_else(|err| err.into_compile_error());
3233
token_stream.into()
3334
}

0 commit comments

Comments
 (0)