imeq

Struct Compare

Source
pub struct Compare<'a> { /* private fields */ }
Expand description

Compare images

§Example

let image_1 = "images/baseline.jpeg".to_string();

let image_2 = "images/modfied.jpeg".to_string();

let images_match = imeq::Compare::new(image_1, image_2)
    .enable_check_images_have_same_path()
    .enable_check_image_hashes_match()
    .enable_check_images_dimensions_match()
    .enable_check_images_pixels_match()
    .are_match();

if images_match {
    println!("Images are a match");
} else {
    println!("Images are not a match");
}

Implementations§

Source§

impl Compare<'_>

Compare images

Source

pub fn new(image_1: String, image_2: String) -> Self

Create a new Image comparson

Source

pub fn enable_check(&mut self, check: &'static str) -> &mut Self

Enable or disable a check

Source

pub fn enable_check_images_have_same_path(&mut self) -> &mut Self

Enable check for images having the same path

Source

pub fn enable_check_image_hashes_match(&mut self) -> &mut Self

Enable check for image hashes matching

Source

pub fn enable_check_images_dimensions_match(&mut self) -> &mut Self

Enable check for image dimensions matching

Source

pub fn enable_check_images_pixels_match(&mut self) -> &mut Self

Enable check for image pixels matching

Source

pub fn are_match(&self) -> bool

Compare images and return if they are a match

Source

pub fn arent_match(&self) -> bool

Compare images and return if they are not a match

Auto Trait Implementations§

§

impl<'a> Freeze for Compare<'a>

§

impl<'a> RefUnwindSafe for Compare<'a>

§

impl<'a> Send for Compare<'a>

§

impl<'a> Sync for Compare<'a>

§

impl<'a> Unpin for Compare<'a>

§

impl<'a> UnwindSafe for Compare<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.