EntityToDefinitionTypes

Trait EntityToDefinitionTypes 

Source
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 formation
  • Formed : 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 EntityToDefinition as 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§

Source

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 :

  • Storage type compatible with the entity’s field requirements
  • Formed type matching the target entity type
  • Context type appropriate for the formation scenario

Implementations on Foreign Types§

Source§

impl<E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for BinaryHeap<E>
where E: Ord,

Source§

type Types = BinaryHeapDefinitionTypes<E, Context, Formed>

Source§

impl<E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for BTreeSet<E>

Source§

type Types = BTreeSetDefinitionTypes<E, Context, Formed>

Source§

impl<E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for LinkedList<E>

Source§

type Types = LinkedListDefinitionTypes<E, Context, Formed>

Source§

impl<E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for VecDeque<E>

Source§

type Types = VecDequeDefinitionTypes<E, Context, Formed>

Source§

impl<E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for Vec<E>

Source§

type Types = VectorDefinitionTypes<E, Context, Formed>

Source§

impl<K, Context, Formed> EntityToDefinitionTypes<Context, Formed> for HashSet<K>
where K: Eq + Hash,

Source§

type Types = HashSetDefinitionTypes<K, Context, Formed>

Source§

impl<K, E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for BTreeMap<K, E>
where K: Ord,

Source§

type Types = BTreeMapDefinitionTypes<K, E, Context, Formed>

Source§

impl<K, E, Context, Formed> EntityToDefinitionTypes<Context, Formed> for HashMap<K, E>
where K: Eq + Hash,

Source§

type Types = HashMapDefinitionTypes<K, E, Context, Formed>

Implementors§