ImageReader

Trait ImageReader 

Source
pub trait ImageReader:
    Send
    + Sync
    + Debug {
    // Required method
    fn read_images<'a>(
        &self,
        paths: impl Iterator<Item = &'a str>,
    ) -> Result<Vec<RgbImage>, OCRError>;

    // Provided method
    fn validate_paths<'a>(
        &self,
        paths: impl Iterator<Item = &'a str>,
    ) -> Result<(), OCRError> { ... }
}
Expand description

Trait for image reading and I/O operations.

This trait handles loading images from various sources (file paths, URLs, memory) and converting them to a standard RGB format for processing.

Required Methods§

Source

fn read_images<'a>( &self, paths: impl Iterator<Item = &'a str>, ) -> Result<Vec<RgbImage>, OCRError>

Read images from file paths.

§Arguments
  • paths - Iterator over file paths to read
§Returns

Vector of loaded RGB images or an error

Provided Methods§

Source

fn validate_paths<'a>( &self, paths: impl Iterator<Item = &'a str>, ) -> Result<(), OCRError>

Validate that images can be read from the given paths.

§Arguments
  • paths - Iterator over file paths to validate
§Returns

Result indicating success or validation error

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§