pub trait MediaStreamClassifierBackend:
Debug
+ Send
+ Sync {
// Required methods
fn classify_by_local_file(&self, file: &Path) -> MimeResult<MediaStreamType>;
fn classify_by_content(
&self,
reader: &mut dyn Read,
) -> MimeResult<MediaStreamType>;
}Expand description
Core implementation contract for classifiers that can handle local files and streams.
Required Methods§
Sourcefn classify_by_local_file(&self, file: &Path) -> MimeResult<MediaStreamType>
fn classify_by_local_file(&self, file: &Path) -> MimeResult<MediaStreamType>
Classifies one validated local file.
§Parameters
file: Readable local media file.
§Returns
Media stream classification.
§Errors
Returns MimeError::Io or another MimeError
when backend classification fails.
Sourcefn classify_by_content(
&self,
reader: &mut dyn Read,
) -> MimeResult<MediaStreamType>
fn classify_by_content( &self, reader: &mut dyn Read, ) -> MimeResult<MediaStreamType>
Classifies media bytes from a stream.
§Parameters
reader: Media stream to classify.
§Returns
Media stream classification.
§Errors
Returns MimeError::Io or another MimeError
when backend classification fails.