Struct http_fs::StaticFiles
source · pub struct StaticFiles<W, C> { /* private fields */ }
Expand description
Static files service
Implementations§
source§impl<W: FsTaskSpawner> StaticFiles<W, DefaultConfig>
impl<W: FsTaskSpawner> StaticFiles<W, DefaultConfig>
sourcepub fn default_with(worker: W) -> Self
pub fn default_with(worker: W) -> Self
Creates new instance with default config.
source§impl<W: FsTaskSpawner, C: StaticFileConfig> StaticFiles<W, C>
impl<W: FsTaskSpawner, C: StaticFileConfig> StaticFiles<W, C>
sourcepub fn serve(&self, path: &Path) -> ServeEntry
pub fn serve(&self, path: &Path) -> ServeEntry
Serves file
sourcepub fn handle_not_found(
&self,
path: &Path,
out_headers: &mut HeaderMap
) -> (StatusCode, Bytes)
pub fn handle_not_found( &self, path: &Path, out_headers: &mut HeaderMap ) -> (StatusCode, Bytes)
Handles not found directory
sourcepub fn handle_dir(
&self,
path: &Path,
dir: ReadDir,
out_headers: &mut HeaderMap
) -> Bytes
pub fn handle_dir( &self, path: &Path, dir: ReadDir, out_headers: &mut HeaderMap ) -> Bytes
Serve directory routine
sourcepub fn serve_file(
&self,
path: &Path,
file: File,
meta: Metadata,
method: Method,
headers: &HeaderMap,
out_headers: &mut HeaderMap
) -> (StatusCode, Body<W, C::FileService>)
pub fn serve_file( &self, path: &Path, file: File, meta: Metadata, method: Method, headers: &HeaderMap, out_headers: &mut HeaderMap ) -> (StatusCode, Body<W, C::FileService>)
Serves file routine
sourcepub fn serve_http(
&self,
method: &Method,
uri: &Uri,
headers: &HeaderMap
) -> Response<Body<W, C::FileService>>
pub fn serve_http( &self, method: &Method, uri: &Uri, headers: &HeaderMap ) -> Response<Body<W, C::FileService>>
Serves http
request
Trait Implementations§
source§impl<W: Clone, C: Clone> Clone for StaticFiles<W, C>
impl<W: Clone, C: Clone> Clone for StaticFiles<W, C>
source§fn clone(&self) -> StaticFiles<W, C>
fn clone(&self) -> StaticFiles<W, C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for StaticFiles<TokioWorker, DefaultConfig>
impl Default for StaticFiles<TokioWorker, DefaultConfig>
source§impl<W: FsTaskSpawner, C: StaticFileConfig> Service<Request<Incoming>> for StaticFiles<W, C>
impl<W: FsTaskSpawner, C: StaticFileConfig> Service<Request<Incoming>> for StaticFiles<W, C>
§type Response = Response<Body<W, <C as StaticFileConfig>::FileService>>
type Response = Response<Body<W, <C as StaticFileConfig>::FileService>>
Responses given by the service.
§type Error = Infallible
type Error = Infallible
Errors produced by the service.
Auto Trait Implementations§
impl<W, C> RefUnwindSafe for StaticFiles<W, C>where C: RefUnwindSafe, W: RefUnwindSafe,
impl<W, C> Send for StaticFiles<W, C>where C: Send, W: Send,
impl<W, C> Sync for StaticFiles<W, C>where C: Sync, W: Sync,
impl<W, C> Unpin for StaticFiles<W, C>where C: Unpin, W: Unpin,
impl<W, C> UnwindSafe for StaticFiles<W, C>where C: UnwindSafe, W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more