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 inTokenTail+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 ofHasP<_>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
Howargument, which resolves the conflict.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".