Skip to main content

Constraint

Trait Constraint 

Source
pub trait Constraint {
    // Required method
    fn valid_range() -> RangeInclusive<i64>;

    // Provided method
    fn validate(value: i64) -> Result<i64, Error> { ... }
}
Expand description

A trait for defining constraints on Amount

Required Methods§

Source

fn valid_range() -> RangeInclusive<i64>

Returns the range of values that are valid under this constraint

Provided Methods§

Source

fn validate(value: i64) -> Result<i64, Error>

Check if an input value is within the valid range

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§