Skip to content

Commit

Permalink
Don't depend on axum-macros in examples
Browse files Browse the repository at this point in the history
All macros are re-exported by axum.
  • Loading branch information
davidpdrsn committed Jul 26, 2023
1 parent 0151aee commit f93998f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions examples/customize-extractor-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ edition = "2021"
publish = false

[dependencies]
axum = { path = "../../axum" }
axum = { path = "../../axum", features = ["macros"] }
axum-extra = { path = "../../axum-extra" }
axum-macros = { path = "../../axum-macros" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions examples/customize-extractor-error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ already existing extractors

- [`with_rejection`](src/with_rejection.rs): Uses
`axum_extra::extract::WithRejection` to transform one rejection into another
- [`derive_from_request`](src/derive_from_request.rs): Uses
`axum_macros::FromRequest` to wrap another extractor and customize the
rejection
- [`derive_from_request`](src/derive_from_request.rs): Uses the
`axum::extractr::FromRequest` derive macro to wrap another extractor and
customize the rejection
- [`custom_extractor`](src/custom_extractor.rs): Manual implementation of
`FromRequest` that wraps another extractor

Expand Down
8 changes: 5 additions & 3 deletions examples/customize-extractor-error/src/derive_from_request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Uses `axum_macros::FromRequest` to wrap another extractor and customize the
//! Uses `axum::extract::FromRequest` to wrap another extractor and customize the
//! rejection
//!
//! + Easy learning curve: Deriving `FromRequest` generates a `FromRequest`
Expand All @@ -11,8 +11,10 @@
//!
//! [`thiserror`]: https://crates.io/crates/thiserror
//! [FromRequest#known-limitations]: https://docs.rs/axum-macros/*/axum_macros/derive.FromRequest.html#known-limitations
use axum::{extract::rejection::JsonRejection, http::StatusCode, response::IntoResponse};
use axum_macros::FromRequest;
use axum::{
extract::rejection::JsonRejection, extract::FromRequest, http::StatusCode,
response::IntoResponse,
};
use serde_json::{json, Value};

pub async fn handler(Json(value): Json<Value>) -> impl IntoResponse {
Expand Down
3 changes: 1 addition & 2 deletions examples/diesel-async-postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ edition = "2021"
publish = false

[dependencies]
axum = { path = "../../axum" }
axum-macros = { path = "../../axum-macros" }
axum = { path = "../../axum", features = ["macros"] }
bb8 = "0.8"
diesel = "2"
diesel-async = { version = "0.3", features = ["postgres", "bb8"] }
Expand Down
3 changes: 1 addition & 2 deletions examples/diesel-postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ edition = "2021"
publish = false

[dependencies]
axum = { path = "../../axum" }
axum-macros = { path = "../../axum-macros" }
axum = { path = "../../axum", features = ["macros"] }
deadpool-diesel = { version = "0.4.1", features = ["postgres"] }
diesel = { version = "2", features = ["postgres"] }
diesel_migrations = "2"
Expand Down

0 comments on commit f93998f

Please sign in to comment.