Struct rocket_contrib::serve::Options [−][src]
pub struct Options(_);Expand description
A bitset representing configurable options for the StaticFiles handler.
The valid options are:
Options::None- Return only present, visible files.Options::DotFiles- In addition to visible files, return dotfiles.Options::Index- Renderindex.htmlpages for directory requests.Options::NormalizeDirs- Redirect directories without a trailing slash to ones with a trailing slash.
Options structures can be ord together to select two or more options.
For instance, to request that both dot files and index pages be returned,
use Options::DotFiles | Options::Index.
Implementations
Options representing the empty set. No dotfiles or index pages are
rendered. This is different than Options::default(),
which enables Index.
Options enabling responding to requests for a directory with the
index.html file in that directory, if it exists. When this is enabled,
the StaticFiles handler will respond to requests for a directory
/foo with the file ${root}/foo/index.html if it exists. This is
enabled by default.
Options enabling returning dot files. When this is enabled, the
StaticFiles handler will respond to requests for files or
directories beginning with .. This is not enabled by default.
Options that normalizes directory requests by redirecting requests to
directory paths without a trailing slash to ones with a trailing slash.
When enabled, the StaticFiles handler will respond to requests for a
directory without a trailing / with a permanent redirect (308) to the
same path with a trailing /. This ensures relative URLs within any
document served for that directory will be interpreted relative to that
directory, rather than its parent. This is not enabled by default.
Returns true if self is a superset of other. In other words,
returns true if all of the options in other are also in self.
Example
use rocket_contrib::serve::Options;
let index_request = Options::Index | Options::DotFiles;
assert!(index_request.contains(Options::Index));
assert!(index_request.contains(Options::DotFiles));
let index_only = Options::Index;
assert!(index_only.contains(Options::Index));
assert!(!index_only.contains(Options::DotFiles));
let dot_only = Options::DotFiles;
assert!(dot_only.contains(Options::DotFiles));
assert!(!dot_only.contains(Options::Index));Trait Implementations
The default set of options: Options::Index.
Auto Trait Implementations
impl RefUnwindSafe for Options
impl UnwindSafe for Options
Blanket Implementations
Mutably borrows from an owned value. Read more