Module property_list

Module property_list 

Source
Expand description

A PropertyList<E> is just a tuple of distinct properties of the same Entity E. It is used in two distinct places: as an initialization list for a new entity, and as a query.

Both use cases have the following two constraints:

  1. The properties are properties of the same entity.
  2. The properties are distinct.

We enforce the first constraint with the type system by only implementing PropertyList<E> for tuples of types implementing Property<E> (of length up to some max). Using properties for mismatched entities will result in a nice compile-time error at the point of use.

Unfortunately, the second constraint has to be enforced at runtime. We implement PropertyList::validate() to do this.

For both use cases, the order in which the properties appear is unimportant in spite of the Rust language semantics of tuple types.

Traitsยง

PropertyList