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§
Sourcetype Constraint: Copy
type Constraint: Copy
Type of constraint information for this type.
Required Methods§
Sourcefn validate(
value: Slot<'_, Self>,
constraint: Self::Constraint,
) -> Result<(), ValidationError>
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.