Trait HasProp

Source
pub trait HasProp<P, How> { }
Expand description

A marker trait to ensure that the builder has received a specific required prop. For each required impl in a property, we generate:

  • a struct with the name of the prop, which takes the place of P.
  • a token wrapper, HasP<TokenTail>, that records that the build state represented includes the state in TokenTail + P. Such tokens are returned from the setter on the builder, to verify the build state.
  • An impl<T> HasP<T>: HasProp<P, _> saying that a state represented by a token of HasP<_> indeed verifies P has been set.
  • An impl<Q> HasP<Tail>: HasProp<Q, _> where Tail: HasProp<Q> saying that any props set previously (represented by the tail) is still set after P has been set.
  • ^ the two impls would be overlapping, where it not for the How argument, which resolves the conflict.

Implementorsยง