pub fn format_text_result(result: &MatchResult) -> StringExpand description
Format a single match result as text
Converts a match result into a human-readable string format similar to
the GNU file command output. The format includes the message from the
matching rule.
§Arguments
result- The match result to format
§Returns
A formatted string containing the match message
§Examples
use libmagic_rs::output::{MatchResult, text::format_text_result};
use libmagic_rs::parser::ast::Value;
let result = MatchResult::new(
"ELF 64-bit LSB executable".to_string(),
0,
Value::Bytes(vec![0x7f, 0x45, 0x4c, 0x46])
);
let formatted = format_text_result(&result);
assert_eq!(formatted, "ELF 64-bit LSB executable");