pub trait ValidateResult {
    // Required method
    fn validate_result(
        &self,
        lossy_result: &Self,
        options: ValidationOptions,
        context: impl Fn() -> String
    ) -> ValidationResult;

    // Provided method
    fn assert_equals_result(&self, result: &Self) { ... }
}
Expand description

Compare two objects, but with a few special quirks. Intended mainly for unit testing.

Required Methods§

source

fn validate_result( &self, lossy_result: &Self, options: ValidationOptions, context: impl Fn() -> String ) -> ValidationResult

Compare self with the other. Exceptional behaviour:

  • Any two NaN values are considered equal, regardless of bit representation.
  • If a lossy is specified, any two values that differ only by a small amount will be considered equal.
  • If nan_to_zero is true, and self is NaN/Infinite and the other value is zero, they are considered equal (because some compression methods replace nan with zero)

This does not work the other way around! This method is not symmetrical!

Provided Methods§

source

fn assert_equals_result(&self, result: &Self)

Compare self with the other. Panics if not equal.

Exceptional behaviour: This does not work the other way around! This method is not symmetrical! Returns whether the result is correct for this image. For lossy compression methods, uses approximate equality. Intended for unit testing.

Warning: If you use SpecificChannels, the comparison might be inaccurate for images with mixed compression methods. This is to be used with AnyChannels mainly.

Implementations on Foreign Types§

source§

impl ValidateResult for u32

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl<A, B, C> ValidateResult for (A, B, C)where A: Clone + ValidateResult, B: Clone + ValidateResult, C: Clone + ValidateResult,

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl<A, B, C, D> ValidateResult for (A, B, C, D)where A: Clone + ValidateResult, B: Clone + ValidateResult, C: Clone + ValidateResult, D: Clone + ValidateResult,

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl<S> ValidateResult for Option<S>where S: ValidateResult,

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl<A> ValidateResult for Vec<A>where A: ValidateResult,

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl ValidateResult for f32

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

source§

impl<T> ValidateResult for &[T]where T: ValidateResult,

source§

fn validate_result( &self, other: &Self, options: ValidationOptions, location: impl Fn() -> String ) -> ValidationResult

Implementors§