guess_and_report_string

Function guess_and_report_string 

Source
pub fn guess_and_report_string(
    content: impl Into<String>,
) -> Result<DetectionReport>
Expand description

Guesses format candidates and generates a detection report from a String. The report populates file_origin as FileOrigin::Synthetic.

ยงExamples

use ctb_formats_detection::{guess_and_report_string, FormatId};

let html = "<!DOCTYPE html><html><body><h1>Header</h1></body></html>";
let report = guess_and_report_string(html)?;
assert_eq!(report.candidates[0].format_id, Some(FormatId::Html));