pub trait EntityToDefinitionTypes<Context, Formed> {
type Types: FormerDefinitionTypes;
}Expand description
Provides a mapping between a type of entity and its associated formation type definitions.
This trait is a simplified version of EntityToDefinition that focuses purely on type
relationships without requiring end condition specification. It’s particularly useful
in scenarios where the formation logic needs to understand type relationships without
needing complete formation control.
§Type Parameters
Context: The contextual information available during formationFormed: The final type that results from the formation process
§Purpose and Usage
This trait serves as a building block for more complex formation scenarios :
- Type system integration for subforms
- Generic parameter propagation in nested structures
- Context type determination in hierarchical builders
- Storage type resolution for complex generic scenarios
§Relationship to Other Traits
- Simpler than
EntityToDefinitionas it doesn’t specify end conditions - Used internally by the Former macro for type resolution
- Enables proper generic parameter handling in complex hierarchies
Required Associated Types§
Sourcetype Types: FormerDefinitionTypes
type Types: FormerDefinitionTypes
Specifies the FormerDefinitionTypes that define the storage, formed entity, and context types used during formation.
This association is essential for ensuring that the formation process is carried out with the correct type-specific logic. The types specified here must be consistent with the entity’s actual structure and requirements.
§Type Requirements
The associated [Types] must implement FormerDefinitionTypes with :
Storagetype compatible with the entity’s field requirementsFormedtype matching the target entity typeContexttype appropriate for the formation scenario