mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-31 02:52:53 +01:00
fix doc tests
This commit is contained in:
parent
3c69d078b2
commit
6d48593a60
@ -196,6 +196,7 @@ impl AnyGuard {
|
||||
}
|
||||
|
||||
impl Guard for AnyGuard {
|
||||
#[inline]
|
||||
fn check(&self, ctx: &GuardContext<'_>) -> bool {
|
||||
for guard in &self.guards {
|
||||
if guard.check(ctx) {
|
||||
@ -247,12 +248,14 @@ impl AllGuard {
|
||||
}
|
||||
|
||||
impl Guard for AllGuard {
|
||||
#[inline]
|
||||
fn check(&self, ctx: &GuardContext<'_>) -> bool {
|
||||
for guard in &self.guards {
|
||||
if !guard.check(ctx) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
||||
@ -271,6 +274,7 @@ impl Guard for AllGuard {
|
||||
pub struct Not<G>(pub G);
|
||||
|
||||
impl<G: Guard> Guard for Not<G> {
|
||||
#[inline]
|
||||
fn check(&self, ctx: &GuardContext<'_>) -> bool {
|
||||
!self.0.check(ctx)
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ use crate::{
|
||||
///
|
||||
/// As responder:
|
||||
/// ```
|
||||
/// use actix_web::web::Redirect;
|
||||
/// use actix_web::{web::Redirect, Responder};
|
||||
///
|
||||
/// async fn handler() -> impl Responder {
|
||||
/// // sends a permanent (308) redirect to duck.com
|
||||
@ -84,13 +84,13 @@ impl Redirect {
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use actix_web::web::Redirect;
|
||||
/// use actix_web::{web::Redirect, Responder};
|
||||
///
|
||||
/// async fn admin_page() -> impl Responder {
|
||||
/// // sends a temporary 307 redirect to the login path
|
||||
/// Redirect::to("/login")
|
||||
/// }
|
||||
/// # actix_web::web::to(handler);
|
||||
/// # actix_web::web::to(admin_page);
|
||||
/// ```
|
||||
pub fn to(to: impl Into<Cow<'static, str>>) -> Self {
|
||||
Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user