Trait exr::image::validate_results::ValidateResult
source · 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§
sourcefn validate_result(
&self,
lossy_result: &Self,
options: ValidationOptions,
context: impl Fn() -> String,
) -> ValidationResult
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§
sourcefn assert_equals_result(&self, result: &Self)
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.
Object Safety§
This trait is not object safe.