Struct staticfile::Static
[−]
[src]
pub struct Static { pub root: PathBuf, }
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.
Methods
impl Static
[src]
fn new<P: Into<PathBuf>>(root: P) -> Static
Create a new instance of Static
with a given root path.
If Path::new("")
is given, files will be served from the current directory.
Trait Implementations
impl Clone for Static
[src]
fn clone(&self) -> Static
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Handler for Static
[src]
fn handle(&self, req: &mut Request) -> IronResult<Response>
Produce a Response
from a Request, with the possibility of error.