Constrained

Trait Constrained 

Source
pub trait Constrained {
    type Constraint: Copy;

    // Required method
    fn validate(
        value: Slot<'_, Self>,
        constraint: Self::Constraint,
    ) -> Result<(), ValidationError>;
}
Expand description

Implemented by types that have constraints that can be validated.

Required Associated Types§

Source

type Constraint: Copy

Type of constraint information for this type.

Required Methods§

Source

fn validate( value: Slot<'_, Self>, constraint: Self::Constraint, ) -> Result<(), ValidationError>

Validate a value of this type against a constraint. Can be called when pointers/envelopes are just presence markers.

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.

Implementations on Foreign Types§

Source§

impl<T: Constrained, const N: usize> Constrained for [T; N]

Source§

type Constraint = <T as Constrained>::Constraint

Source§

fn validate( slot: Slot<'_, Self>, constraint: Self::Constraint, ) -> Result<(), ValidationError>

Implementors§