Trait trillium_static::StaticConnExt
source · pub trait StaticConnExt {
// Required methods
fn send_path<'async_trait, A>(
self,
path: A,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where A: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait;
fn send_file<'async_trait>(
self,
file: File,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait;
fn send_file_with_options<'life0, 'async_trait>(
self,
file: File,
options: &'life0 StaticOptions,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_path_with_options<'life0, 'async_trait, A>(
self,
path: A,
options: &'life0 StaticOptions,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where A: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'life0: 'async_trait;
fn with_mime_from_path(self, path: impl AsRef<Path>) -> Self;
}
Expand description
conn extension trait to facilitate sending individual files and paths
Required Methods§
sourcefn send_path<'async_trait, A>(
self,
path: A,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
fn send_path<'async_trait, A>( self, path: A, ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
Send the file at the provided path. Will send a 404 if the file cannot be resolved or if it is a directory.
sourcefn send_file<'async_trait>(
self,
file: File,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
fn send_file<'async_trait>(
self,
file: File,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
Send the file at the provided path. Will send a 404 if the file cannot be resolved or if it is a directory.
sourcefn send_file_with_options<'life0, 'async_trait>(
self,
file: File,
options: &'life0 StaticOptions,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_file_with_options<'life0, 'async_trait>(
self,
file: File,
options: &'life0 StaticOptions,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send the file at the provided path. Will send a 404 if the file cannot be resolved or if it is a directory.
sourcefn send_path_with_options<'life0, 'async_trait, A>(
self,
path: A,
options: &'life0 StaticOptions,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
fn send_path_with_options<'life0, 'async_trait, A>( self, path: A, options: &'life0 StaticOptions, ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
Send the file at the provided path. Will send a 404 if the file cannot be resolved or if it is a directory.
sourcefn with_mime_from_path(self, path: impl AsRef<Path>) -> Self
fn with_mime_from_path(self, path: impl AsRef<Path>) -> Self
Guess the mime type for this fs path using
mime_guess
and set the
content-type header
Object Safety§
This trait is not object safe.