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

The path this handler is serving files from.

Methods

impl Static
[src]

[src]

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Handler for Static
[src]

[src]

Produce a Response from a Request, with the possibility of error.

impl Set for Static
[src]

Modify self using the provided modifier.

Modify self through a mutable reference with the provided modifier.