[][src]Struct tide_naive_static_files::StaticFilesEndpoint

pub struct StaticFilesEndpoint {
    pub root: PathBuf,
}

A struct that holds a path to your app's static assets directory. This struct implements tide::Endpoint so it can be passed directly to tide::Route::get.

The static assets will be served from the route provided to the app.at. In the example below, the file ./my-static-asset-dir/foo.html would be obtainable by making a GET request to http://my.server.address/static/foo.html.

use tide_naive_static_files::StaticFilesEndpoint;

let mut app = tide::new();
app.at("/static").strip_prefix().get(StaticFilesEndpoint {
    root: "./my-static-asset-dir/".into(),
});

Fields

root: PathBuf

Trait Implementations

impl<State> Endpoint<State> for StaticFilesEndpoint[src]

type Fut = Pin<Box<dyn Future<Output = Response> + Send>>

The async result of call.

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<State, F, Fut> Endpoint<State> for F where
    F: 'static + Send + Sync + Fn(Request<State>) -> Fut,
    Fut: Future + Send + 'static,
    <Fut as Future>::Output: IntoResponse
[src]

type Fut = Pin<Box<dyn Future<Output = Response> + 'static + Send>>

The async result of call.

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

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

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.