Struct poem::web::StaticFileRequest
source · pub struct StaticFileRequest { /* private fields */ }
Expand description
An extractor for responding static files.
Implementations§
source§impl StaticFileRequest
impl StaticFileRequest
sourcepub fn create_response_from_data(
self,
data: impl AsRef<[u8]>
) -> Result<StaticFileResponse, StaticFileError>
pub fn create_response_from_data( self, data: impl AsRef<[u8]> ) -> Result<StaticFileResponse, StaticFileError>
Create static file response.
prefer_utf8
- Specifies whether text responses should signal a UTF-8
encoding.
sourcepub fn create_response(
self,
path: impl AsRef<Path>,
prefer_utf8: bool
) -> Result<StaticFileResponse, StaticFileError>
pub fn create_response( self, path: impl AsRef<Path>, prefer_utf8: bool ) -> Result<StaticFileResponse, StaticFileError>
Create static file response.
prefer_utf8
- Specifies whether text responses should signal a UTF-8
encoding.
Trait Implementations§
source§impl Debug for StaticFileRequest
impl Debug for StaticFileRequest
source§impl<'a> FromRequest<'a> for StaticFileRequest
impl<'a> FromRequest<'a> for StaticFileRequest
source§fn from_request<'life0, 'async_trait>(
req: &'a Request,
_body: &'life0 mut RequestBody
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn from_request<'life0, 'async_trait>( req: &'a Request, _body: &'life0 mut RequestBody ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,
Extract from request head and body.
Auto Trait Implementations§
impl RefUnwindSafe for StaticFileRequest
impl Send for StaticFileRequest
impl Sync for StaticFileRequest
impl Unpin for StaticFileRequest
impl UnwindSafe for StaticFileRequest
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> TowerCompatExt for T
impl<T> TowerCompatExt for T
source§fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: HttpBody + Send + 'static,
ResBody::Data: Into<Bytes> + Send + 'static,
ResBody::Error: StdError + Send + Sync + 'static,
Err: Into<Error>,
Self: Service<Request<Body>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where ResBody: HttpBody + Send + 'static, ResBody::Data: Into<Bytes> + Send + 'static, ResBody::Error: StdError + Send + Sync + 'static, Err: Into<Error>, Self: Service<Request<Body>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static, Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
Available on crate feature
tower-compat
only.Converts a tower service to a poem endpoint.