pub struct StaticFilesMiddleware { /* private fields */ }Expand description
Static file serving middleware
Implementations§
Source§impl StaticFilesMiddleware
impl StaticFilesMiddleware
Sourcepub fn from_config(config: &Config) -> Self
pub fn from_config(config: &Config) -> Self
Create new static files middleware from configuration
Trait Implementations§
Source§impl Middleware for StaticFilesMiddleware
impl Middleware for StaticFilesMiddleware
Source§fn request_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn request_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if request matches static path and serve file
This runs BEFORE proxying to upstream, allowing us to intercept static file requests and serve them directly.
Source§fn response_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_upstream_response: &'life2 mut ResponseHeader,
_ctx: &'life3 mut MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn response_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_upstream_response: &'life2 mut ResponseHeader,
_ctx: &'life3 mut MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Process response before sending to client
Auto Trait Implementations§
impl Freeze for StaticFilesMiddleware
impl RefUnwindSafe for StaticFilesMiddleware
impl Send for StaticFilesMiddleware
impl Sync for StaticFilesMiddleware
impl Unpin for StaticFilesMiddleware
impl UnwindSafe for StaticFilesMiddleware
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