Macro __define_derived_property_common

Source
macro_rules! __define_derived_property_common {
    (
        $derived_property:ident,
        $value:ty,
        $canonical_value:ty,
        $compute_canonical_impl:expr,
        $compute_uncanonical_impl:expr,
        $at_dependency_registration:expr,
        [$($dependency:ident),*],
        [$($global_dependency:ident),*],
        |$($param:ident),+| $derive_fn:expr,
        $display_impl:expr,
        $hash_fn:expr,
        $type_id_impl:expr
    ) => { ... };
}
Expand description

Defines a derived person property with the following parameters:

  • $person_property: A name for the identifier type of the property
  • $value: The type of the property’s value
  • [$($dependency),+]: A list of person properties the derived property depends on
  • [$($dependency),*]: A list of global properties the derived property depends on (optional)
  • $calculate: A closure that takes the values of each dependency and returns the derived value
  • $display: A closure that takes the value of the derived property and returns a string representation
  • $hash_fn: A function that can compute the hash of values of this property