[−][src]Trait pergola::DefTraits
DefTraits
is used to constrain LatticeDef
s and also type parameters
of structs that implement LatticeDef
. This requires some explaining.
A LatticeDef
is typically just a unit-struct with no content aside from
PhantomData
-- it's essentially a module to be used as a parameter to a
LatticeElt
-- so it doesn't obviously make sense to constrain them at all.
But: since LatticeDef
s wind up as type parameters for a variety of
structs in client libraries (that themselves contain LatticeElt
s that
use those LatticeDef
s), any attempt to derive standard traits on such
structs will bump into a bug in
derive which prevents
derived impls from working right if a struct's type parameters don't
themselves implement the derived traits.
So to keep derive working downstream, we insist all LatticeDef
s provide
most standard derivable traits. Impls for them can be derived on the
LatticeDef
s trivially anyways, so this isn't much of a burden.