fif/src/findings.rs

22 lines
548 B
Rust

use std::path::PathBuf;
use mime_guess::Mime;
use crate::inspectors::mime_extension_lookup;
/// Information about a scanned file.
pub struct Findings {
/// The location of the scanned file.
pub file: PathBuf, // TODO: replace with Path???? <'a> and all that
/// Whether or not the file's extension is valid for its mimetype.
pub valid: bool,
/// The file's mimetype.
pub mime: Mime,
}
impl Findings {
pub fn recommended_extension(&self) -> Option<&str> {
mime_extension_lookup(self.mime.clone()).map(|extensions| &*extensions[0])
}
}