EmbedRespondable

Trait EmbedRespondable 

Source
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§

Required Methods§

Source

fn data(&self) -> Self::Data

The contents of the embedded file.

Source

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.

Source

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.

Source

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.

Source

fn last_modified_timestamp(&self) -> Option<i64>

The UNIX timestamp of when the file was last modified.

Source

fn last_modified(&self) -> Option<Self::LastModified>

The rfc2822 encoded last modified date.

Source

fn etag(&self) -> Self::ETag

The ETag value for the file, based on its hash.

Source

fn mime_type(&self) -> Option<Self::MimeType>

The mime type for the file, if one has been guessed.

Implementations on Foreign Types§

Source§

impl EmbedRespondable for EmbeddedFile

Implementors§