pub trait EmbedRespondable {
type Data: MessageBody + 'static + AsRef<[u8]>;
type DataGzip: MessageBody + 'static + AsRef<[u8]>;
type DataBr: MessageBody + 'static + AsRef<[u8]>;
type DataZstd: MessageBody + 'static + AsRef<[u8]>;
type MimeType: AsRef<str>;
type ETag: AsRef<str>;
type LastModified: AsRef<str>;
// Required methods
fn data(&self) -> Self::Data;
fn data_gzip(&self) -> Option<Self::DataGzip>;
fn data_br(&self) -> Option<Self::DataBr>;
fn data_zstd(&self) -> Option<Self::DataZstd>;
fn last_modified_timestamp(&self) -> Option<i64>;
fn last_modified(&self) -> Option<Self::LastModified>;
fn etag(&self) -> Self::ETag;
fn mime_type(&self) -> Option<Self::MimeType>;
}Expand description
A common trait used internally to create HTTP responses.
This trait is internally implemented for both rust-embed and
rust-embed-for-web types. You could also implement it for your own type if
you wish to use the response handling capabilities of this crate without
embedded files.
Required Associated Types§
type Data: MessageBody + 'static + AsRef<[u8]>
type DataGzip: MessageBody + 'static + AsRef<[u8]>
type DataBr: MessageBody + 'static + AsRef<[u8]>
type DataZstd: MessageBody + 'static + AsRef<[u8]>
type MimeType: AsRef<str>
type ETag: AsRef<str>
type LastModified: AsRef<str>
Required Methods§
Sourcefn data_gzip(&self) -> Option<Self::DataGzip>
fn data_gzip(&self) -> Option<Self::DataGzip>
The contents of the file compressed with gzip.
Some if precompression has been done, None if the file was not precompressed.
Sourcefn data_br(&self) -> Option<Self::DataBr>
fn data_br(&self) -> Option<Self::DataBr>
The contents of the file compressed with brotli.
Some if precompression has been done, None if the file was not precompressed.
Sourcefn data_zstd(&self) -> Option<Self::DataZstd>
fn data_zstd(&self) -> Option<Self::DataZstd>
The contents of the file compressed with zstd.
Some if precompression has been done, None if the file was not precompressed.
Sourcefn last_modified_timestamp(&self) -> Option<i64>
fn last_modified_timestamp(&self) -> Option<i64>
The UNIX timestamp of when the file was last modified.
Sourcefn last_modified(&self) -> Option<Self::LastModified>
fn last_modified(&self) -> Option<Self::LastModified>
The rfc2822 encoded last modified date.