Trait Predicate

Source
pub trait Predicate<T> {
    // Required method
    fn test(x: &T) -> bool;
}
Expand description

A Predicate tests if a value satisfies a particular refinement type.

Used in conjunction with Refinement.

§Example

use refinement::Predicate;

struct LessThanTen;

impl Predicate<i32> for LessThanTen {
    fn test(x: &i32) -> bool {
        *x < 10
    }
}

Required Methods§

Source

fn test(x: &T) -> bool

Test if a value satisfies the Predicate.

See Refinement for usage examples.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§