pub struct EvaluationResult {
pub description: String,
pub mime_type: Option<String>,
pub confidence: f64,
pub matches: Vec<RuleMatch>,
pub metadata: EvaluationMetadata,
}Expand description
Result of magic rule evaluation
Contains the file type description, optional MIME type, confidence score, individual match details, and evaluation metadata.
§Examples
use libmagic_rs::{EvaluationResult, EvaluationMetadata};
let result = EvaluationResult {
description: "ELF 64-bit executable".to_string(),
mime_type: Some("application/x-executable".to_string()),
confidence: 0.9,
matches: vec![],
metadata: EvaluationMetadata::default(),
};
assert_eq!(result.description, "ELF 64-bit executable");
assert!(result.confidence > 0.5);Fields§
§description: StringHuman-readable file type description
This is the concatenated message from all matching rules, following libmagic behavior where hierarchical matches are joined with spaces (unless backspace character is used).
mime_type: Option<String>Optional MIME type for the detected file type
Only populated when enable_mime_types is set in the configuration.
confidence: f64Confidence score (0.0 to 1.0)
Based on the depth of the match in the rule hierarchy. Deeper matches indicate more specific identification.
matches: Vec<RuleMatch>Individual match results from rule evaluation
Contains details about each rule that matched, including offset, matched value, and per-match confidence.
metadata: EvaluationMetadataMetadata about the evaluation process
Trait Implementations§
Source§impl Clone for EvaluationResult
impl Clone for EvaluationResult
Source§fn clone(&self) -> EvaluationResult
fn clone(&self) -> EvaluationResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more