Struct resource_proxy_pingora::metadata::Metadata
source · pub struct Metadata {
pub mime: Mime,
pub size: u64,
pub modified: Option<String>,
pub etag: String,
}
Expand description
Helper wrapping file metadata information
Fields§
§mime: Mime
Guessed MIME types (if any) for the file
size: u64
File size in bytes
modified: Option<String>
Last modified time of the file in the format Fri, 15 May 2015 15:34:21 GMT
if the time
can be retrieved
etag: String
ETag header for the file, encoding last modified time and file size
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn from_path<P: AsRef<Path> + ?Sized>(
path: &P,
orig_path: Option<&P>,
) -> Result<Self, Error>
pub fn from_path<P: AsRef<Path> + ?Sized>( path: &P, orig_path: Option<&P>, ) -> Result<Self, Error>
Collects the metadata for a file. If orig_path
is present, it will be used to determine
the MIME type instead of path
.
This method will return any errors produced by std::fs::metadata()
. It will also result
in a ErrorKind::InvalidInput
error if the path given doesn’t point to a regular file.
sourcepub fn has_failed_precondition(&self, session: &impl SessionWrapper) -> bool
pub fn has_failed_precondition(&self, session: &impl SessionWrapper) -> bool
Checks If-Match
and If-Unmodified-Since
headers of the request to determine whether
a 412 Precondition Failed
response should be produced.
sourcepub fn is_not_modified(&self, session: &impl SessionWrapper) -> bool
pub fn is_not_modified(&self, session: &impl SessionWrapper) -> bool
Checks If-None-Match
and If-Modified-Since
headers of the request to determine whether
a 304 Not Modified
response should be produced.