pub trait ContentExtractor: Send + Sync {
// Required methods
fn supported_types(&self) -> &[&str];
fn extract<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn can_extract(&self, path: &Path, mime_type: &str) -> bool { ... }
fn can_extract_by_extension(&self, _path: &Path) -> bool { ... }
fn extract_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_data: &'life1 [u8],
_mime_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Trait for extracting content from files.
Required Methods§
Sourcefn supported_types(&self) -> &[&str]
fn supported_types(&self) -> &[&str]
Returns the MIME types this extractor can handle.
Sourcefn extract<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extract<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extract content from a file.
Provided Methods§
Sourcefn can_extract(&self, path: &Path, mime_type: &str) -> bool
fn can_extract(&self, path: &Path, mime_type: &str) -> bool
Check if this extractor can handle the given file.
Sourcefn can_extract_by_extension(&self, _path: &Path) -> bool
fn can_extract_by_extension(&self, _path: &Path) -> bool
Check if extractor can handle based on file extension.
Sourcefn extract_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_data: &'life1 [u8],
_mime_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn extract_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_data: &'life1 [u8],
_mime_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<ExtractedContent, ExtractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Extract content from bytes (for embedded content).