pub struct Static {
pub root: PathBuf,
}
Expand description
The static file-serving Handler
.
This handler serves files from a single filesystem path, which may be absolute or relative.
Incoming requests are mapped onto the filesystem by appending their URL path to the handler’s
root path. If the filesystem path corresponds to a regular file, the handler will attempt to
serve it. Otherwise, if the path corresponds to a directory containing an index.html
,
the handler will attempt to serve that instead.
§Errors
If the path doesn’t match any real object in the filesystem, the handler will return
a Response with status::NotFound
. If an IO error occurs whilst attempting to serve
a file, FileError(IoError)
will be returned.
Fields§
§root: PathBuf
The path this handler is serving files from.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Static
impl RefUnwindSafe for Static
impl Send for Static
impl Sync for Static
impl Unpin for Static
impl UnwindSafe for Static
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