ImageReader

Trait ImageReader 

Source
pub trait ImageReader {
    type Error;

    // Required method
    fn apply<P: AsRef<Path> + Send + Sync>(
        &self,
        imgs: impl IntoIterator<Item = P>,
    ) -> Result<Vec<RgbImage>, Self::Error>;

    // Provided method
    fn read_single<P: AsRef<Path> + Send + Sync>(
        &self,
        img_path: P,
    ) -> Result<RgbImage, Self::Error>
       where Self::Error: From<OCRError> { ... }
}
Expand description

Trait for reading images.

This trait defines the interface for reading images from paths.

Required Associated Types§

Source

type Error

The error type of this image reader.

Required Methods§

Source

fn apply<P: AsRef<Path> + Send + Sync>( &self, imgs: impl IntoIterator<Item = P>, ) -> Result<Vec<RgbImage>, Self::Error>

Applies the image reader to the given paths.

§Arguments
  • imgs - An iterator of paths to the images to read.
§Returns

A Result containing a vector of RGB images or an error.

§Constraints
  • P must implement AsRef<Path> + Send + Sync.

Provided Methods§

Source

fn read_single<P: AsRef<Path> + Send + Sync>( &self, img_path: P, ) -> Result<RgbImage, Self::Error>
where Self::Error: From<OCRError>,

Reads a single image from the given path.

§Arguments
  • img_path - The path to the image to read.
§Returns

A Result containing the RGB image or an error.

§Constraints
  • P must implement AsRef<Path> + Send + Sync.

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§