// Builds the Etag from the last modified time and the size
// of the file.
Builds the Etag from the last modified time and the size
of the file.
Builds the Etag from the last modified time and the size of the file .
pub(crate) fn for_file(file: &File) -> String {
        if let Ok(metadata) = file.metadata() {
            match metadata.modified().map(|modified| {
                modified
                    .duration_since(std::time::UNIX_EPOCH)
                    .expect("Modified is earlier than time::UNIX_EPOCH!")
            }) {
                Ok(modified) => format!(
                    "W/\"{}.{}-{}\"",
                    modified.as_secs(),
                    modified.subsec_nanos(),
                    metadata.len()
                ),
                _ => format!("W/\"{}\"", metadata.len()),
            }
        } else {
            String::new()
        }
    }
pub ( crate ) fn for_file ( file : & File ) -> String { if let Ok ( metadata ) = file . metadata ( ) { match metadata . modified ( ) . map ( | modified | { modified . duration_since ( std :: time :: UNIX_EPOCH ) . expect ( " " ) } ) { Ok ( modified ) => format ! ( " \" \" " modified as_secs ( ) modified subsec_nanos ( ) metadata len ( ) ) , _ => format ! ( " \" \" " metadata len ( ) ) , } } else { String :: new ( ) } }
Builds the Etag from the last modified time and the size
of the file.
Builds the Etag from the last modified time and the size of the file .
file
&File