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:
@ -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.
|
||||
///
|
||||
/// ```
|
||||
|
Reference in New Issue
Block a user