Skip to main content

Constraint

Trait Constraint 

Source
pub trait Constraint<T> {
    const NAME: &'static str;

    // Required method
    fn satisfied(value: &T) -> bool;
}
Expand description

A constraint that a Safe<T, C> value must satisfy.

Implement this for a zero-sized marker type C to make it usable with Safe::try_new and the crate::safe! macro.

Required Associated Constants§

Source

const NAME: &'static str

Stable, human-readable identifier (e.g. "!nan").

Required Methods§

Source

fn satisfied(value: &T) -> bool

Returns true if value satisfies the constraint.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Constraint<f64> for Finite

Source§

const NAME: &'static str = "!nan,!inf"

Source§

impl Constraint<f64> for NonInf

Source§

const NAME: &'static str = "!inf"

Source§

impl Constraint<f64> for NonNan

Source§

const NAME: &'static str = "!nan"