mirror of https://github.com/fafhrd91/actix-web
add documentation on Files guard
This commit is contained in:
parent
d2d388ff83
commit
7416630d65
|
@ -172,8 +172,21 @@ impl Files {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies custom guards to use for directory listings and files.
|
/// Add match guard to use on directory listings and files.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use actix_web::{guard, App};
|
||||||
|
/// use actix_files::Files;
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// fn main() {
|
||||||
|
/// let app = App::new()
|
||||||
|
/// .service(
|
||||||
|
/// Files::new("/","/my/site/files")
|
||||||
|
/// .guard(guard::Header("Host", "example.com"))
|
||||||
|
/// );
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn guard<G: Guard + 'static>(mut self, guard: G) -> Self {
|
pub fn guard<G: Guard + 'static>(mut self, guard: G) -> Self {
|
||||||
self.guards.push(Box::new(guard));
|
self.guards.push(Box::new(guard));
|
||||||
|
|
Loading…
Reference in New Issue