Add serde_codegen::expand to avoid public Syntex dependency
Required for #358. We can remove `serde_codegen::register` in the next breaking release.
This allows Syntex users to avoid being broken by Serde bumping its Syntex dependency.
Attribute for handwritten where clauses
Addresses (2) and (3) in https://github.com/serde-rs/serde/issues/336#issuecomment-220378916.
- If there is a `#[serde(bound="...")]` attribute on the type, use the union of that and the actual type's `where` clause as the `where` clause for the impl and do not attempt to generate any additional `where` clauses whatsoever.
- If there is a `#[serde(bound="...")]` attribute on a field, use that and do not attempt to generate any additional `where` clauses for the field.
The `bound` attribute behaves similar to `rename` in that you can specify a single attribute that applies to both ser and de, or individual ones.
```
#[serde(bound="D: Serialize + Deserialize")]
#[serde(bound(serialize="D: Serialize", deserialize="D: Deserialize"))]
```
EDIT: now addresses (4) from https://github.com/serde-rs/serde/issues/336#issuecomment-220378916 as well.
- If a field contains direct recursion, do not generate any bounds based on that field except from `bound` attributes.
Reduce code duplication in Deserialize generator
This combines `deserialize_newtype_struct`, `deserialize_tuple_struct`, and `deserialize_tuple_variant` into a single method `deserialize_tuple`, as well as `deserialize_struct` and `deserialize_struct_variant` into a single method `deserialize_struct`. No behavior changes.
feat(codegen): Detect repeated struct field when deserializing
Addresses #59. Let me know whether you think we need an escape hatch to opt out of this check.