pub trait File {
// Required methods
fn content(&self) -> &[u8] ⓘ;
fn content_gzip(&self) -> Option<&[u8]>;
fn content_brotli(&self) -> Option<&[u8]>;
fn content_type(&self) -> HeaderValue;
fn etag(&self) -> HeaderValue;
fn cache_control(&self) -> CacheControl;
}
Expand description
Trait for single file inside a pack
. Consists of body in different
encodings (identity
aka normal
, gzip
, brotli
), some precomputed
header values etc.
Most users will indirectly use FileArchived implementation, obtained from crate::pack::Pack::get_file_by_path (implemented by crate::common::pack::PackArchived). This trait is also implemented for non-archived File_, mostly for testing purposes.
Required Methods§
Sourcefn content_gzip(&self) -> Option<&[u8]>
fn content_gzip(&self) -> Option<&[u8]>
Accesses file content in gzip
encoding if available.
Sourcefn content_brotli(&self) -> Option<&[u8]>
fn content_brotli(&self) -> Option<&[u8]>
Accesses file content in brotli
encoding if available.
Sourcefn content_type(&self) -> HeaderValue
fn content_type(&self) -> HeaderValue
Accesses content-type
header contents for this file.
Sourcefn etag(&self) -> HeaderValue
fn etag(&self) -> HeaderValue
Accesses ETag
header contents for this file.
Sourcefn cache_control(&self) -> CacheControl
fn cache_control(&self) -> CacheControl
Accesses CacheControl for this file.