Skip to main content

FormatDetector

Trait FormatDetector 

Source
pub trait FormatDetector: Send + Sync {
    // Required methods
    fn detect(
        &self,
        body: &[u8],
        content_type: Option<&str>,
    ) -> Option<FormatId>;
    fn name(&self) -> &str;
}
Expand description

Detects the format of a body payload.

Required Methods§

Source

fn detect(&self, body: &[u8], content_type: Option<&str>) -> Option<FormatId>

Inspect bytes and return the detected format, or None if unknown.

Source

fn name(&self) -> &str

Human-readable detector name.

Implementors§