Native64RawRealStrictFinitePolicy

Type Alias Native64RawRealStrictFinitePolicy 

Source
pub type Native64RawRealStrictFinitePolicy = StrictFinitePolicy<f64, 53>;
Expand description

A type alias for a validation policy that enforces strict finiteness for the raw f64 type.

This is a convenient alias for StrictFinitePolicy<f64, 53>, configured specifically for Rust’s native 64-bit floating-point number. It is used to validate that a given f64 value is suitable for use within the library’s validated types.

This policy ensures that a f64 value is:

  • Not NaN (Not a Number).
  • Not positive or negative Infinity.
  • Not a subnormal number.

It is a fundamental building block for the native f64 kernel, providing the validation logic for RealNative64StrictFinite.

§Example

use num_valid::validation::{Native64RawRealStrictFinitePolicy, ErrorsValidationRawReal};
use try_create::ValidationPolicy;

// A valid finite number passes validation.
assert!(Native64RawRealStrictFinitePolicy::validate(1.0).is_ok());

// NaN fails validation.
let result_nan = Native64RawRealStrictFinitePolicy::validate(f64::NAN);
assert!(matches!(result_nan, Err(ErrorsValidationRawReal::IsNaN { .. })));

// Infinity fails validation.
let result_inf = Native64RawRealStrictFinitePolicy::validate(f64::INFINITY);
assert!(matches!(result_inf, Err(ErrorsValidationRawReal::IsPosInfinity { .. })));

Aliased Type§

pub struct Native64RawRealStrictFinitePolicy(/* private fields */);

Trait Implementations§

Source§

impl ValidationPolicy for Native64RawRealStrictFinitePolicy

Ensures the f64 value is strictly finite.

This policy checks if the f64 value is:

  • Not NaN (Not a Number).
  • Not positive or negative Infinity.
  • Not subnormal.

§Errors

Returns ErrorsValidationRawReal<f64> if the value fails any of these checks.

Source§

type Value = f64

The type of the value to be validated.
Source§

type Error = ErrorsValidationRawReal<f64>

The type of the error returned if validation fails.
Source§

fn validate_ref(value: &f64) -> Result<(), Self::Error>

Validates a value by reference. Read more
Source§

fn validate(v: Self::Value) -> Result<Self::Value, Self::Error>

Validates a value by consuming it. Read more