Enum poem_openapi::response::StaticFileResponse
source · [−]pub enum StaticFileResponse {
Ok(Binary<Body>, Option<String>, Option<String>),
NotModified,
BadRequest,
NotFound,
PreconditionFailed,
RangeNotSatisfiable(String),
InternalServerError(PlainText<String>),
}
static-files
only.Expand description
A static file response.
Variants
Ok(Binary<Body>, Option<String>, Option<String>)
Tuple Fields
1: Option<String>
The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource. It lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed. Additionally, etags help to prevent simultaneous updates of a resource from overwriting each other (“mid-air collisions”).
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
2: Option<String>
The Last-Modified response HTTP header contains a date and time when the origin server believes the resource was last modified. It is used as a validator to determine if the resource is the same as the previously stored one. Less accurate than an ETag header, it is a fallback mechanism. Conditional requests containing If-Modified-Since or If-Unmodified-Since headers make use of this field.
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
Ok
NotModified
Not modified
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
BadRequest
Bad request
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
NotFound
Resource was not found
PreconditionFailed
Precondition failed
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412
RangeNotSatisfiable(String)
Tuple Fields
0: String
The Content-Range response HTTP header indicates where in a full body message a partial message belongs.
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
Range not satisfiable
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416
InternalServerError(PlainText<String>)
Internal server error
Implementations
sourceimpl StaticFileResponse
impl StaticFileResponse
sourcepub fn new(res: Result<StaticFileResponse, StaticFileError>) -> Self
pub fn new(res: Result<StaticFileResponse, StaticFileError>) -> Self
Create a static file response.
Trait Implementations
sourceimpl ApiResponse for StaticFileResponse
impl ApiResponse for StaticFileResponse
sourceconst BAD_REQUEST_HANDLER: bool
const BAD_REQUEST_HANDLER: bool
If true, it means that the response object has a custom bad request handler. Read more
sourcefn register(registry: &mut Registry)
fn register(registry: &mut Registry)
Register the schema contained in this response object to the registry.
sourcefn from_parse_request_error(err: Error) -> Self
fn from_parse_request_error(err: Error) -> Self
Convert poem::Error
to this response object.
sourceimpl From<Result<StaticFileResponse, StaticFileError>> for StaticFileResponse
impl From<Result<StaticFileResponse, StaticFileError>> for StaticFileResponse
sourcefn from(res: Result<StaticFileResponse, StaticFileError>) -> Self
fn from(res: Result<StaticFileResponse, StaticFileError>) -> Self
Performs the conversion.
sourceimpl IntoResponse for StaticFileResponse
impl IntoResponse for StaticFileResponse
sourcefn into_response(self) -> Response
fn into_response(self) -> Response
Consume itself and return Response
.
sourcefn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Wrap an impl IntoResponse
to add a header. Read more
sourcefn with_content_type<V>(self, content_type: V) -> WithContentType<Self> where
V: TryInto<HeaderValue>,
fn with_content_type<V>(self, content_type: V) -> WithContentType<Self> where
V: TryInto<HeaderValue>,
Wrap an impl IntoResponse
to with a new content type. Read more
sourcefn with_status(self, status: StatusCode) -> WithStatus<Self>
fn with_status(self, status: StatusCode) -> WithStatus<Self>
Wrap an impl IntoResponse
to set a status code. Read more
Auto Trait Implementations
impl !RefUnwindSafe for StaticFileResponse
impl Send for StaticFileResponse
impl Sync for StaticFileResponse
impl Unpin for StaticFileResponse
impl !UnwindSafe for StaticFileResponse
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoResult<T> for T where
T: IntoResponse,
impl<T> IntoResult<T> for T where
T: IntoResponse,
sourcefn into_result(self) -> Result<T, Error>
fn into_result(self) -> Result<T, Error>
Consumes this value returns a poem::Result<T>
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more