-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom state as member of
AppContext
Add the app's custom state as a member of the `AppContext` this has several benefits: - Only need to pass the `AppContext` as a parameter to methods, instead of separate methods for the `AppContext` and the custom state. This reduces boilerplate and simplfies many method defs. - We can ensure the custom state can be cheaply cloned by wrapping in an `Arc` inside the `AppContext`. - We no longer require the consumer to implement an `Into<AppContext>` (or similar) trait.
- Loading branch information
1 parent
b70596f
commit 04fda90
Showing
36 changed files
with
253 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
use crate::app_state::AppState; | ||
use aide::axum::ApiRouter; | ||
use roadster::app_context::AppContext; | ||
|
||
pub mod example; | ||
|
||
pub fn routes(parent: &str) -> ApiRouter<AppState> { | ||
pub fn routes(parent: &str) -> ApiRouter<AppContext<AppState>> { | ||
ApiRouter::new().merge(example::routes(parent)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.