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>
Source§type Response = Response<Body<W, <C as StaticFileConfig>::FileService>>
type Response = Response<Body<W, <C as StaticFileConfig>::FileService>>
Responses given by the service.
Source§type Error = Infallible
type Error = Infallible
Errors produced by the service. Read more
Auto Trait Implementations§
impl<W, C> Freeze for StaticFiles<W, C>
impl<W, C> RefUnwindSafe for StaticFiles<W, C>where
W: RefUnwindSafe,
C: RefUnwindSafe,
impl<W, C> Send for StaticFiles<W, C>
impl<W, C> Sync for StaticFiles<W, C>
impl<W, C> Unpin for StaticFiles<W, C>
impl<W, C> UnwindSafe for StaticFiles<W, C>where
W: UnwindSafe,
C: 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