pub type Native64RawComplexStrictFinitePolicy = StrictFinitePolicy<Complex<f64>, 53>;Expand description
A type alias for a validation policy that enforces strict finiteness for the raw num::Complex<f64> type.
This is a convenient alias for StrictFinitePolicy<Complex<f64>, 53>, configured for
Rust’s native 64-bit complex numbers. It is used to validate that a given num::Complex<f64>
value is suitable for use within the library’s validated types.
This policy applies the strict finiteness check (as defined by Native64RawRealStrictFinitePolicy)
to both the real and imaginary parts of the complex number. A num::Complex<f64> value is considered
valid if and only if both of its components are finite (not NaN, Infinity, or subnormal).
It is a fundamental building block for the native f64 kernel, providing the validation
logic for ComplexNative64StrictFinite.
§Example
use num_valid::validation::{Native64RawComplexStrictFinitePolicy, ErrorsValidationRawComplex, ErrorsValidationRawReal};
use try_create::ValidationPolicy;
use num::Complex;
// A complex number with valid finite parts passes validation.
let valid_complex = Complex::new(1.0, -2.0);
assert!(Native64RawComplexStrictFinitePolicy::validate(valid_complex).is_ok());
// A complex number with NaN in the real part fails validation.
let nan_complex = Complex::new(f64::NAN, 2.0);
let result_nan = Native64RawComplexStrictFinitePolicy::validate(nan_complex);
assert!(matches!(result_nan, Err(ErrorsValidationRawComplex::InvalidRealPart { .. })));
// A complex number with Infinity in the imaginary part fails validation.
let inf_complex = Complex::new(1.0, f64::INFINITY);
let result_inf = Native64RawComplexStrictFinitePolicy::validate(inf_complex);
assert!(matches!(result_inf, Err(ErrorsValidationRawComplex::InvalidImaginaryPart { .. })));
// A complex number with invalid parts in both also fails.
let both_invalid = Complex::new(f64::NAN, f64::INFINITY);
let result_both = Native64RawComplexStrictFinitePolicy::validate(both_invalid);
assert!(matches!(result_both, Err(ErrorsValidationRawComplex::InvalidBothParts { .. })));Aliased Type§
pub struct Native64RawComplexStrictFinitePolicy(/* private fields */);Trait Implementations§
Source§impl ValidationPolicy for Native64RawComplexStrictFinitePolicy
Ensures both the real and imaginary parts of a Complex<f64> value are strictly finite.
impl ValidationPolicy for Native64RawComplexStrictFinitePolicy
Ensures both the real and imaginary parts of a Complex<f64> value are strictly finite.
This policy applies the StrictFinitePolicy<f64> to both
the real and imaginary components of the complex number.
§Errors
Returns ErrorsValidationRawComplex<ErrorsValidationRawReal<f64>>
if either the real part, the imaginary part, or both parts fail the
StrictFinitePolicy<f64> checks.