forked from LukeMathWalker/pavex
-
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.
Do not integrate the ToC in the left sidebar on the documentation web…
…site. We adjusted the allowed width for pavex errors accordingly.
- Loading branch information
1 parent
ab45cc3
commit 6b4eae4
Showing
8 changed files
with
26 additions
and
58 deletions.
There are no files selected for viewing
27 changes: 7 additions & 20 deletions
27
doc_examples/guide/dependency_injection/kit/project/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 6 additions & 8 deletions
14
doc_examples/guide/dependency_injection/user_middleware/project/src/authentication.rs
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,16 +1,14 @@ | ||
use std::future::IntoFuture; | ||
|
||
use pavex::middleware::Next; | ||
use pavex::middleware::Processing; | ||
use pavex::response::Response; | ||
|
||
use crate::user::User; | ||
|
||
pub async fn reject_anonymous<C>(user: &User, next: Next<C>) -> Response | ||
where | ||
C: IntoFuture<Output=Response>, | ||
pub fn reject_anonymous(user: &User) -> Processing | ||
{ | ||
if let User::Anonymous = user { | ||
return Response::unauthorized(); | ||
let r = Response::unauthorized(); | ||
Processing::EarlyReturn(r) | ||
} else { | ||
Processing::Continue | ||
} | ||
next.into_future().await | ||
} |
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
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