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 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.

fn bitor(self, rhs: Self) -> Self[src]

Performs the | operation. Read more

impl Clone for Options[src]

fn clone(&self) -> Options[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Options[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Options[src]

The default set of options: Options::Index.

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl Copy for Options[src]

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn as_result(self) -> Result<T, ParseErr<I>>

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> IntoCollection<T> for T

pub fn into_collection<A>(self) -> SmallVec<A> where
    A: Array<Item = T>, 

Converts self into a collection.

pub fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
    F: FnMut(T) -> U,
    A: Array<Item = U>, 

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

Convert self to an expression for Diesel’s query builder. Read more

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel’s query builder. Read more

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.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

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

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

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

pub fn vzip(self) -> V