pub trait StaticConnExt: Send {
// Required methods
fn send_path<A: AsRef<Path> + Send>(
self,
path: A,
) -> impl Future<Output = Conn> + Send;
fn send_file(self, file: File) -> impl Future<Output = Conn> + Send;
fn send_file_with_options(
self,
file: File,
options: &StaticOptions,
) -> impl Future<Output = Conn> + Send;
fn send_path_with_options<A: AsRef<Path> + Send>(
self,
path: A,
options: &StaticOptions,
) -> impl Future<Output = Conn> + Send;
fn with_mime_from_path(self, path: impl AsRef<Path>) -> Self;
fn resolved_directory(&self) -> Option<&ResolvedDirectory>;
}Expand description
conn extension trait to facilitate sending individual files and paths
Required Methods§
Sourcefn send_path<A: AsRef<Path> + Send>(
self,
path: A,
) -> impl Future<Output = Conn> + Send
fn send_path<A: AsRef<Path> + Send>( self, path: A, ) -> impl Future<Output = Conn> + Send
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(self, file: File) -> impl Future<Output = Conn> + Send
fn send_file(self, file: File) -> impl Future<Output = Conn> + Send
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(
self,
file: File,
options: &StaticOptions,
) -> impl Future<Output = Conn> + Send
fn send_file_with_options( self, file: File, options: &StaticOptions, ) -> impl Future<Output = Conn> + Send
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<A: AsRef<Path> + Send>(
self,
path: A,
options: &StaticOptions,
) -> impl Future<Output = Conn> + Send
fn send_path_with_options<A: AsRef<Path> + Send>( self, path: A, options: &StaticOptions, ) -> impl Future<Output = Conn> + Send
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
Sourcefn resolved_directory(&self) -> Option<&ResolvedDirectory>
fn resolved_directory(&self) -> Option<&ResolvedDirectory>
If StaticFileHandler resolved this
request’s path to a directory but did not serve a file from it (no
index file configured, or the configured index was absent), returns the
resolved directory. A downstream handler can use this to render a
directory listing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".