guess_and_report_dcs

Function guess_and_report_dcs 

Source
pub fn guess_and_report_dcs(
    dcs: impl Borrow<DcString>,
) -> Result<DetectionReport>
Expand description

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

ยงExamples

use ctb_formats_detection::{guess_and_report_dcs, DcString, FormatId};

let dcs = DcString::from_dcutf(
    b"<!DOCTYPE html><html><body>Test</body></html>".to_vec(),
)?;
let report = guess_and_report_dcs(&dcs)?;
assert_eq!(report.candidates[0].format_id, Some(FormatId::Html));