1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-02 01:05:08 +02:00

add support of filtering guards in Files of actix-files (#2046)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
tglman
2021-04-22 18:13:13 +01:00
committed by GitHub
parent 07036b5640
commit f44a0bc159
6 changed files with 91 additions and 7 deletions

View File

@ -26,6 +26,8 @@
//! ```
#![allow(non_snake_case)]
use std::convert::TryFrom;
use std::ops::Deref;
use std::rc::Rc;
use actix_http::http::{self, header, uri::Uri};
use actix_http::RequestHead;
@ -40,6 +42,12 @@ pub trait Guard {
fn check(&self, request: &RequestHead) -> bool;
}
impl Guard for Rc<dyn Guard> {
fn check(&self, request: &RequestHead) -> bool {
self.deref().check(request)
}
}
/// Create guard object for supplied function.
///
/// ```