pub trait SchemaConstructible: ValueObject + Sized {
// Required methods
fn from_schema_and_value(
definition: &AttributeDefinition,
value: &Value,
) -> ValidationResult<Self>;
fn can_construct_from(definition: &AttributeDefinition) -> bool;
// Provided method
fn constructor_priority() -> u8 { ... }
}Expand description
Trait for value objects that can be created from schema definitions.
This trait enables the dynamic factory pattern where value objects are constructed based on schema attribute definitions and JSON values.
Required Methods§
Sourcefn from_schema_and_value(
definition: &AttributeDefinition,
value: &Value,
) -> ValidationResult<Self>
fn from_schema_and_value( definition: &AttributeDefinition, value: &Value, ) -> ValidationResult<Self>
Create a value object from a JSON value and schema definition
Sourcefn can_construct_from(definition: &AttributeDefinition) -> bool
fn can_construct_from(definition: &AttributeDefinition) -> bool
Check if this type can handle the given attribute definition
Provided Methods§
Sourcefn constructor_priority() -> u8
fn constructor_priority() -> u8
Get the priority for this constructor (higher = preferred) Used when multiple constructors might handle the same definition
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.