[][src]Trait pergola::DefTraits

pub trait DefTraits: Debug + Ord + Clone + Hash + Default + Serialize + DeserializeOwned { }

DefTraits is used to constrain LatticeDefs 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 LatticeDefs wind up as type parameters for a variety of structs in client libraries (that themselves contain LatticeElts that use those LatticeDefs), 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 LatticeDefs provide most standard derivable traits. Impls for them can be derived on the LatticeDefs trivially anyways, so this isn't much of a burden.

Implementors

impl<T: Debug + Ord + Clone + Hash + Default + Serialize + DeserializeOwned> DefTraits for T[src]

Loading content...