Skip to main content

Extractor

Trait Extractor 

Source
pub trait Extractor: Send + Sync {
    // Required methods
    fn supports(
        &self,
        source: &ResourceId,
        locator: &ResourceLocator,
        metadata: &ResourceMetadata,
    ) -> bool;
    fn extract(
        &self,
        bytes: &[u8],
        source: &ResourceId,
        locator: &ResourceLocator,
        metadata: &ResourceMetadata,
    ) -> Result<ExtractedContent>;
}
Expand description

Convert verified resource bytes into readable evidence.

Use extract_resource or crate::SearchEngine::extract for provider-backed extraction. Direct calls to extract must supply bytes already verified against metadata.content_hash. The central gateway verifies before calling any implementation. Future range/streaming extractors need a separate method.

Unstable: may change before 1.0 (a range/streaming method is planned for audio and video).

Required Methods§

Source

fn supports( &self, source: &ResourceId, locator: &ResourceLocator, metadata: &ResourceMetadata, ) -> bool

Source

fn extract( &self, bytes: &[u8], source: &ResourceId, locator: &ResourceLocator, metadata: &ResourceMetadata, ) -> Result<ExtractedContent>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§