pub trait Constrained {
type Constraint: Copy;
// Required method
fn validate(
slot: 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(
slot: Slot<'_, Self>,
constraint: Self::Constraint,
) -> Result<(), ValidationError>
fn validate( slot: Slot<'_, Self>, constraint: Self::Constraint, ) -> Result<(), ValidationError>
Validate a slot 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".