pub struct Metadata {
pub mime: MimeGuess,
pub size: u64,
pub modified: Option<String>,
pub etag: String,
}Expand description
Helper wrapping file metadata information
Fields§
§mime: MimeGuessGuessed MIME types (if any) for the file
size: u64File 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: StringETag 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: &Session) -> bool
pub fn has_failed_precondition(&self, session: &Session) -> 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: &Session) -> bool
pub fn is_not_modified(&self, session: &Session) -> bool
Checks If-None-Match and If-Modified-Since headers of the request to determine whether
a 304 Not Modified response should be produced.