pub struct Files { /* private fields */ }Expand description
Serves files from a directory, refusing anything that escapes it.
Implementations§
Source§impl Files
impl Files
pub fn new(root: impl Into<PathBuf>) -> Self
Sourcepub fn cache_control(self, value: impl Into<String>) -> Self
pub fn cache_control(self, value: impl Into<String>) -> Self
Sets the cache-control header sent with every file.
Use it when the URLs carry a content hash, and the file at a given URL therefore can never change:
Files::new("public").cache_control("public, max-age=31536000, immutable");pub fn without_index(self) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Files
impl RefUnwindSafe for Files
impl Send for Files
impl Sync for Files
impl Unpin for Files
impl UnsafeUnpin for Files
impl UnwindSafe for Files
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more