[][src]Struct rocket_contrib::serve::Options

pub struct Options(_);

A bitset representing configurable options for the StaticFiles handler.

The valid options are:

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

impl Options[src]

pub const None: Options[src]

Options representing the empty set. No dotfiles or index pages are rendered. This is different than Options::default(), which enables Index.

pub const Index: Options[src]

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.

pub const DotFiles: Options[src]

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.

pub const NormalizeDirs: Options[src]

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.

pub fn contains(self, other: Options) -> bool[src]

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

impl BitOr<Options> for Options[src]

type Output = Self

The resulting type after applying the | operator.

impl Clone for Options[src]

impl Copy for Options[src]

impl Debug for Options[src]

impl Default for Options[src]

The default set of options: Options::Index.

Auto Trait Implementations

impl RefUnwindSafe for Options

impl Send for Options

impl Sync for Options

impl Unpin for Options

impl UnwindSafe for Options

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, I> AsResult<T, I> for T where
    I: Input, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoCollection<T> for T

impl<T> IntoSql for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,