David Tolnay
a732b9bad3
Fix codegen with lifetimes but no type parameters
2016-08-19 11:12:38 -04:00
Homu
d120539310
Auto merge of #478 - serde-rs:visitor, r=oli-obk
...
Simplify generated visitors
Neither `__FieldVisitor` nor `__Visitor` need the `__D: Deserializer` type parameter.
2016-08-08 19:52:36 +09:00
David Tolnay
c539563687
Remove unnecessary nesting fron generated Deserialize implementations
2016-08-03 21:08:17 -07:00
David Tolnay
d5102a7afd
Simplify generated visitors
2016-08-03 19:56:47 -07:00
David Tolnay
f25e6d3ea9
Close the seq before failing on invalid length
...
Equivalent to what 0f9a930 does for maps.
2016-07-05 10:08:36 -07:00
David Tolnay
431cbe48b7
Merge pull request #422 from serde-rs/missing
...
Close the map before checking for missing fields
2016-07-05 07:11:03 -07:00
David Tolnay
0f9a930c4f
Close the map before checking for missing fields
2016-07-05 01:42:38 -07:00
David Tolnay
1a449bb3d0
Invalid-length when enum seq is too short
2016-07-05 01:35:20 -07:00
David Tolnay
149c87d7c2
Record expansion info
2016-07-03 10:53:33 -07:00
David Tolnay
d450de1482
Update syntex to 0.37
2016-07-02 20:20:44 -07:00
David Tolnay
2d5a26dfc0
Rename serde_internals to serde_codegen_internals
2016-06-30 19:53:57 -07:00
David Tolnay
c6b6e2a5d9
Rename serde_item to serde_internals
2016-06-30 19:42:55 -07:00
David Tolnay
5c6a0e12e9
Factor attr parsing into serde_item crate
2016-06-19 20:15:49 -07:00
David Tolnay
ac69524258
Gather attrs at the beginning
2016-06-15 02:38:47 -07:00
David Tolnay
28589620f6
Error on duplicate attributes
2016-06-14 20:39:21 -07:00
David Tolnay
c21bea8b30
Better error when deriving Deserialize for struct containing &str
2016-06-11 21:32:53 -07:00
David Tolnay
3119cc8857
Simplify implementation of #[serde(default=...)]
2016-06-09 23:21:42 -07:00
David Tolnay
578f34ecaf
Use "bound" attribute instead of "where"
2016-06-05 11:17:43 -07:00
David Tolnay
660ea7bd7b
Attribute for handwritten where clauses
2016-06-04 15:48:42 -07:00
David Tolnay
938f42faf6
Support (de)serialize_with in tuples
2016-05-19 10:53:38 -07:00
David Tolnay
7d2423e856
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.
2016-05-15 13:32:54 -07:00
David Tolnay
004dcaec3b
Remove unused imports and needless borrows
2016-05-13 10:47:09 -07:00
Homu
a9a4b2d8e2
Auto merge of #293 - dtolnay:duplicate, r=oli-obk
...
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.
2016-05-11 19:44:34 +09:00
Oliver Schneider
7374ac499d
Merge pull request #311 from dtolnay/deserialize_with
...
Field with deserialize_with should not implement Deserialize
2016-05-11 11:48:19 +02:00
David Tolnay
eeb4efc19c
feat(codegen): Detect repeated struct field when deserializing
2016-05-10 09:52:51 -07:00
David Tolnay
76b70455ec
Field with deserialize_with should not implement Deserialize
2016-05-10 09:50:32 -07:00
David Tolnay
f43c8a6267
Prefix type parameters and lifetimes with double underscore
2016-05-10 09:12:38 -07:00
David Tolnay
f4414bfc14
Reduce dependence on type inference
2016-05-07 15:25:13 -07:00
David Tolnay
305fab7c16
fix(codegen): Support extern crate serde not in toplevel module
2016-04-25 09:58:01 -07:00
Erick Tryzelaar
a959073a81
Merge pull request #296 from erickt/master
...
Fix a warning, bump the versions
2016-04-25 07:58:23 -07:00
Erick Tryzelaar
7bd87feb62
Fix a warning, bump the versions
2016-04-19 12:43:57 -05:00
David Tolnay
fd3c15fb68
fix(codegen): Discard type defaults from impl generics
2016-04-19 10:28:43 -07:00
David Tolnay
886670134a
feat(codegen): Infer Default and Deserialize bounds correctly
2016-04-13 21:56:12 -07:00
David Tolnay
ff02b0c741
fix(codegen): Take into account default=... when skip_deserializing
2016-04-12 23:42:24 -07:00
David Tolnay
87393b61bb
feat(codegen) skip_deserializing
2016-04-10 20:29:37 -07:00
Erick Tryzelaar
a84b6aaedd
Bump syntex/aster/quasi version
2016-04-10 19:54:54 -07:00
Erick Tryzelaar
57433e1eaa
feat(codegen): Optimize deserializing fields from byte strings
2016-02-23 20:38:06 -08:00
Erick Tryzelaar
118476b98b
feat(de): Rename de::Error trait methods
2016-02-23 20:21:07 -08:00
Erick Tryzelaar
740865b637
feat(de): Add an Error::unknown_variant error.
...
Closes #169
2016-02-21 16:26:52 -08:00
Erick Tryzelaar
78cf29d1d1
feat(codegen): Switch attributes to using using paths not expressions
2016-02-21 15:28:25 -08:00
Erick Tryzelaar
40f8e6b061
feat(codegen): Add #[serde(deserialize_with="...")]
...
This allows a field to be deserialized with an expression instead
of the default deserializer. This simplifies deserializing a struct
or enum that contains an external type that doesn't implement
`serde::Deserialize`. This expression is passed a variable
`deserializer` that needs to be used to deserialize the expression.
2016-02-18 19:13:55 -08:00
Erick Tryzelaar
de89f95f31
feat(codegen): Add support for #![serde(skip_serialize_if="$expr")]
...
This allows end users to use an arbitrary expression to decide whether
or not to serialize some field. This expression has access to all the
fields in the struct, but none of the internal state of the Serialize
implementation. For structs, serde implements this by creating a
temporary trait and implementing the struct for it. For struct variants,
the fields are copied by reference into a temporary struct first
before implementing the temporary trait.
This also fixes a bug where the serde_codegen wasn't making calls to
Serializer::serialize_{tuple,struct}_variant{,_elt}.
2016-02-18 19:13:55 -08:00
Erick Tryzelaar
9812a4c9c6
feat(codegen): Allow #[serde(default="123")]
...
This feature adds support for the default to be specified to be
some expression (which unfortunately needs to be parsed from
a string) without needing this value to have an implementation
of `Default`, or for a new-type wrapper in order to provide an
alternative implementation. This expression is run in a function,
and therefore has no access to any of the internal state of
the deserializer.
2016-02-18 19:13:55 -08:00
Erick Tryzelaar
17bf789708
Merge branch 'v0.6.x'
2016-02-18 09:46:46 -08:00
Erick Tryzelaar
f6a66a5537
feat(cargo): Rustup to latest nightly
2016-02-18 09:27:41 -08:00
Erick Tryzelaar
1236889664
Merge branch 'v0.6.x'
...
# Conflicts:
# serde_codegen/src/de.rs
2016-02-14 16:45:59 -08:00
debris
74b230c183
Update serde_codegen for rustc 1.8.0-nightly (ce4b75f25 2016-02-12)
2016-02-14 03:27:20 +01:00
Erick Tryzelaar
561a373d19
Merge branch 'v0.6.x'
...
# Conflicts:
# serde/src/de/mod.rs
# serde_codegen/src/attr.rs
# serde_codegen/src/de.rs
# serde_codegen/src/lib.rs
2016-02-12 21:43:23 -08:00
Erick Tryzelaar
064241f03c
fix(serde): Rename visit_struct_key to visit_struct_field
...
This is more consistent with the rest of the serde naming patterns.
2016-02-12 21:22:42 -08:00
Erick Tryzelaar
32163cd53b
feat(cargo): Version bump
2016-02-12 21:06:47 -08:00