David Tolnay
0dac13e4db
Resolve conflict with pr 1115
2017-12-11 20:59:54 -08:00
David Tolnay
0c2e91f28a
Merge branch serde-rs/master into Gankro/deserialize_from
2017-12-11 20:49:23 -08:00
David Tolnay
13e7bee0e6
Eliminate need for unwrap in deserialize_from_seq
2017-12-11 18:13:13 -08:00
David Tolnay
65104aca9c
Remove need for allow(unreachable_code)
2017-12-11 17:55:23 -08:00
David Tolnay
9360094ba7
Revert main_body naming change
...
The naming here isn't great but no need to change it in this PR.
2017-12-10 23:19:31 -08:00
David Tolnay
d9e894911f
Move all the deserialize_from derive code behind flag
2017-12-10 23:15:14 -08:00
David Tolnay
85e3ddc2b8
Less indentiation in deserialize_from_body
2017-12-10 23:04:44 -08:00
David Tolnay
ccae35d92a
Do not emit deserialize_from if every field has deserialize_with
2017-12-10 22:55:28 -08:00
David Tolnay
61ca928325
Can never see getters in a deserialize_from
2017-12-10 22:46:46 -08:00
David Tolnay
b7eb42aa6b
Release 1.0.24
2017-12-09 14:43:55 -08:00
Jeroen Bollen
aa86b04714
Adressed concerns raised by @oli-obk.
...
Specifically:
- Change identation in `de.rs`.
- Make `attr::Field` take a `attr::Default` as opposed to the entire parent `attr::Container`.
2017-12-08 15:13:05 +01:00
Jeroen Bollen
c887a0b472
Solved #1105 .
...
When a field should be skipped during deserialization, it will not use its own Default implementation
when the container structure has `#[serde(default)]` set.
2017-12-06 21:14:02 +01:00
Alexis Beingessner
e354dd0c7f
Derive deserialize_from for tuples and structs
...
This adds a new "deserialize_from" feature (default off) that opts into
deriving deserialize_from with #[derive(Deserialize)].
2017-12-04 13:23:26 -05:00
David Tolnay
8c34e0940f
Release 1.0.23
2017-11-29 22:26:32 -08:00
David Tolnay
797d049db5
Release 1.0.22
2017-11-29 20:01:43 -08:00
David Tolnay
e0eea551b4
Fix missing absolute paths in deserialize_seq
2017-11-29 19:45:22 -08:00
David Tolnay
f218f4d7bf
Release 1.0.21
2017-11-15 22:24:18 -08:00
David Tolnay
4773863e3a
Release 1.0.20
2017-11-12 10:29:08 -08:00
David Tolnay
88d5fe6bfd
Release 1.0.19
2017-11-06 23:50:24 -08:00
David Tolnay
b8a40551a2
Fix bounds for macro named the same as a type parameter
2017-11-05 12:18:39 -08:00
David Tolnay
ab68132b1f
Release 1.0.18
2017-11-03 10:20:41 -07:00
David Tolnay
d5e5c520ac
Ignore skipped fields when looking for borrowed lifetimes
2017-11-03 10:08:02 -07:00
David Tolnay
ad680cbd44
Release 1.0.17
2017-10-31 09:36:06 -07:00
David Tolnay
826f656e28
Compile and test the serde_derive "example" code
2017-10-22 12:09:56 -07:00
David Tolnay
422191fcb0
Release 1.0.16
2017-10-22 11:29:44 -07:00
David Tolnay
ea1a729088
Release 1.0.15
2017-09-17 13:58:35 -07:00
David Tolnay
b98a9a8f9b
Support deserializing internally tagged enum from seq
...
During serialization, internally tagged enums invoke the Serializer's
serialize_struct. In JSON this turns into a map which uses visit_map
when deserialized. But some formats employ visit_seq when
deserializing a struct. One example is rmp-serde. Such formats were
previously unable to deserialize an internally tagged enum. This
change fixes it by adding visit_seq for internally tagged enums.
2017-09-17 13:45:12 -07:00
David Tolnay
4b00de0e22
Release 1.0.14
2017-09-09 12:50:57 -07:00
David Tolnay
8403fa018e
Merge pull request #1052 from serde-rs/static
...
Special case for 'static fields
2017-09-09 12:50:11 -07:00
David Tolnay
0085d05e55
Special case for 'static fields
2017-09-09 12:39:14 -07:00
David Tolnay
2eed855bff
Fix trivial numeric cast in visit_u64
2017-09-09 12:37:00 -07:00
David Tolnay
c3eced410f
Release 1.0.13
2017-09-09 11:40:31 -07:00
David Tolnay
15b2714058
Merge pull request #1015 from spinda/with-variant
...
implement (de)serialize_with for variants
2017-09-09 10:49:24 -07:00
David Tolnay
9ce107de25
Merge pull request 963 from sfackler/u64-identifier
...
Conflicts:
serde_derive/src/de.rs
2017-09-08 21:35:41 -07:00
Steven Fackler
95407a4ca5
Support field ident deserialization from u32
2017-09-05 21:55:33 -07:00
Steven Fackler
2fe9a860cd
Inform serializers about skipped fields.
...
Closes #960 .
2017-09-05 21:55:33 -07:00
David Tolnay
d4042872f5
Release 1.0.12
2017-09-04 11:11:44 -07:00
Michael Smith
9fc180e62f
Implement deserialize_with for variants
...
Complements variant serialize_with and closes #1013 .
2017-08-14 14:41:05 -07:00
Michael Smith
5b815b7001
Implement serialize_with for variants
...
As discussed in #1013 , serialize_with functions attached to variants receive an
argument for each inner value contained within the variant. Internally such a
function is wired up to the serializer as if the variant were a newtype variant.
2017-08-14 11:17:08 -07:00
David Tolnay
4831482695
Doc comment on statement is not used by rustdoc
...
Fixes #1014 .
2017-08-05 23:35:14 -07:00
David Tolnay
26098ed877
Release 1.0.11
2017-07-27 00:56:28 -07:00
David Tolnay
f36a1e0895
Inherit the visibility of remote struct definition
2017-07-25 23:52:06 -07:00
David Tolnay
83537c95e1
Release 1.0.10
2017-07-11 21:19:24 -07:00
David Tolnay
9ecb0839de
Release 1.0.9
2017-06-29 20:21:29 -07:00
David Tolnay
1d3e921ba6
Fix deserializer bounds on remote derive
2017-06-29 20:12:44 -07:00
Steven Fackler
8e8694261b
Fix identifier deserialization from non-u32
...
Closes #962
2017-06-19 20:23:14 -07:00
David Tolnay
4fdba725fe
Revert "Support deserialization of struct keys from integers"
...
This is not as useful as expected because the Serializer does not know the real
index of each struct field being serialized. The best it can do is keep a
counter, which goes wrong if fields are conditionally skipped.
This reverts commit eec7101894
.
2017-06-18 09:11:21 -07:00
Steven Fackler
eec7101894
Support deserialization of struct keys from integers
...
serde-cbor supports a "packed" serialization flag which causes keys to
be serialized as their indices, but the deserializer currently has to
hardcode support for this format. We can simply support deserialization
of struct keys from integers as we already do for enum variants.
2017-06-17 18:12:07 -07:00
David Tolnay
fd3d1396d3
Release 1.0.8
2017-05-24 00:17:27 -07:00
David Tolnay
c47b4c8e0b
Release 1.0.7
2017-05-19 17:00:31 -07:00
David Tolnay
3d7aad1e7b
Release 1.0.6
2017-05-17 08:20:54 -07:00
David Tolnay
4d5e450054
Release 1.0.5
2017-05-14 12:53:48 -07:00
David Tolnay
c68b959696
Release 1.0.4
2017-05-10 20:05:22 -07:00
David Tolnay
58e30eaee4
Release 1.0.3
2017-05-10 10:15:39 -07:00
David Tolnay
8fafc7420c
Release 1.0.2
2017-04-27 12:32:30 -07:00
David Tolnay
bea1c5b0f5
Remove trailing whitespace
2017-04-27 12:31:13 -07:00
Ted Driggs
2440b59aae
Address feedback on PR #905
...
* Added error test when deny_unknown_fields enabled
* Fixed next_relevant_key to use absolute paths
2017-04-27 12:21:32 -07:00
Ted Driggs
873cfbe9ab
Fix #816 - adjacently-tagged enums honor deny_unknown_fields
2017-04-27 11:24:09 -07:00
David Tolnay
c7901e532e
Release 1.0.1
2017-04-23 16:40:56 -07:00
David Tolnay
d7ccef0cac
Release 1.0.0
2017-04-20 08:19:31 -07:00
David Tolnay
cf1cdadc77
Fix some rustfmt screwups
2017-04-19 15:56:22 -07:00
David Tolnay
d1253cb193
Minimal serde_derive documentation
...
Fixes #886 .
2017-04-19 14:43:53 -07:00
David Tolnay
0240814677
Update post-merge html_root_urls
2017-04-19 14:32:04 -07:00
David Tolnay
7a7d4c6364
Format in rfc style
2017-04-18 14:23:21 -07:00
David Tolnay
c13a37d4db
Rename VariantAccess methods to not conflict with Deserializer
2017-04-15 12:35:04 -07:00
David Tolnay
cdfd445528
Generate deserialize impls for identifiers
2017-04-14 21:53:48 -07:00
David Tolnay
f9535a4d67
Remove "item" terminology in favor of "container"
...
The docs have been using "container" for a long time.
2017-04-14 15:52:58 -07:00
David Tolnay
6d55501dab
Replace "codegen" with "derive"
2017-04-14 15:42:27 -07:00
David Tolnay
e77e7c4bba
Rename Deserializer::deserialize to deserialize_any
2017-04-14 12:52:57 -07:00
David Tolnay
31cec05712
Access traits
2017-04-14 12:24:35 -07:00
David Tolnay
3f920f645c
License boilerplate
2017-04-13 17:34:42 -07:00
David Tolnay
ea8fb97beb
Format in rfc style
2017-04-13 12:32:29 -07:00
David Tolnay
78407e19a9
Export Formatter directly for generated code
2017-04-13 12:02:16 -07:00
David Tolnay
dc7ab2696a
Point html_root_url to docs.rs
2017-04-13 11:31:29 -07:00
David Tolnay
1985cfc955
Merge branch 'origin/1.0' into 'origin/identifier'
...
Conflicts:
serde_derive/src/ser.rs
2017-04-10 12:37:41 -07:00
David Tolnay
2deacf8eaa
Detect incorrect remote type without getter
2017-04-10 12:12:00 -07:00
David Tolnay
52e93150e6
Standardize on u32 as the type of a variant index
2017-04-09 14:03:18 -07:00
David Tolnay
a38b24136b
Rename deserialize_struct_field to deserialize_identifier
...
Because it applies to both struct fields and discriminants of an enum.
2017-04-09 13:35:22 -07:00
David Tolnay
78f682590a
Merge branch 'origin/1.0' into 'origin/remote'
...
Conflicts:
serde_derive/src/de.rs
2017-04-09 13:19:04 -07:00
David Tolnay
1986c17052
Remove conversion from empty seq to unit struct
2017-04-09 13:08:05 -07:00
David Tolnay
9d8987bde8
Require getters to return the correct type
2017-04-09 10:59:54 -07:00
David Tolnay
a6d172111b
Derive for remote types
2017-04-09 10:15:46 -07:00
David Tolnay
726eea9a97
Separate out the private functionality
...
This makes it easier when clicking through [src] links from rustdoc, not having
to sift through public and internal code combined together.
2017-04-07 09:46:48 -07:00
David Tolnay
dd62801b22
Use spaces around =-sign like Rust does
2017-04-06 14:22:03 -07:00
David Tolnay
732b91e53d
Make the built-in visitors private
2017-04-04 18:59:57 -07:00
David Tolnay
fb48111e46
Derive for borrowed fields
2017-04-03 00:40:45 -07:00
David Tolnay
d3a2f5e268
Add a 'de lifetime to the deserialize traits
2017-03-29 00:10:34 -07:00
David Tolnay
08e2182042
UFCS for Option::map and Result::map
2017-03-18 13:31:03 -07:00
David Tolnay
8c7396c35a
Be consistent with UFCS and double underscores
2017-03-18 10:33:22 -07:00
John Baublitz
bc946e4fd7
Macro attributes to specify From and Into trait types for structs and enums ( #817 )
...
* serde macro support for type conversions through From and Into trait
* Revisions requested by dtolnay
* Additional changes requested by dtolnay
2017-03-18 09:22:27 -07:00
David Tolnay
9a3c1243f4
Deserialization of Haskell style enums
2017-02-20 20:05:06 -08:00
David Tolnay
599a1b6607
Fragments that keep track of type of syntax
...
Fixes #777 .
2017-02-20 17:12:35 -08:00
David Tolnay
3d6e086d3e
Support custom paths in container attribute serde(default="...")
2017-02-20 17:06:00 -08:00
David Tolnay
ad480d2b04
Merge pull request #780 from Thomasdezeeuw/default_container
...
Add support for `#[serde(default)]` on structs
2017-02-20 16:10:28 -08:00
David Tolnay
dff919a926
Rename __simple_value to __field0 to be consistent with tuples
2017-02-20 14:16:54 -08:00
David Tolnay
bac593573c
Drop aster dependency
2017-02-20 13:50:17 -08:00
Thomas de Zeeuw
9444db5f19
Add support for #[serde(default)]
on structs
...
This allows structs to use the default value for each field defined in
the struct’s `std::default::Default` implementation, rather then the
default value for the field’s type.
```
struct StructDefault {
a: i32,
b: String,
}
impl Default for StructDefault {
fn default() -> StructDefault {
StructDefault{
a: 100,
b: "default".to_string(),
}
}
}
```
The code above will now return `100` for field `a` and `”default”` for
`b`, rather then `0` and `””` respectively.
2017-02-20 22:35:31 +01:00
David Tolnay
3bf8cda994
Update generics handling to use split_for_impl
2017-02-20 13:04:40 -08:00
David Tolnay
535ab1e04b
Merge pull request #771 from elliottslaughter:internally_content_tagged
2017-02-19 16:08:49 -08:00
David Tolnay
a3fe03c323
Serialization of Haskell style enums
2017-02-19 16:04:39 -08:00
Elliott Slaughter
4538143d00
Initial work to support serialization of adjacently tagged enums.
2017-02-18 20:46:37 -08:00
David Tolnay
adf7b086b5
Remove outdated comment
2017-02-17 20:38:50 -08:00
David Tolnay
e8651a52e7
Rustfmt
2017-02-12 22:15:59 -08:00
Oliver Schneider
393b19ee8a
update codegen to the content changes
2017-02-04 10:37:50 +01:00
David Tolnay
ff21d557c7
Untagged and internally tagged enums
2017-02-02 18:48:30 -08:00
David Tolnay
a55d812441
Even more absolute paths
2017-02-01 12:12:39 -08:00
David Tolnay
b7ca574bb3
Use absolute paths to Ok and Err
2017-02-01 09:42:12 -08:00
Oliver Schneider
368784949e
move to cargo clippy instead of using the clippy plugin ( #733 )
...
* move to cargo clippy instead of using the clippy plugin
fixes #729
* non-exectable scripts must be run with `sh`
* don't build serde in the clippy travis job
* only run clippy tests if installing clippy succeeds
* why is travis so picky?
* no more serde_codegen
* serde_test_suite_deps has no features
* don't use empty loops, llvm optimizes them to undefined behaviour
* abort the clippy job when clippy lints are triggered
* use caches on travis to speed up builds
* why are we even using `travis-cargo`?
* need to reinstall clippy frequently due to nightly updates
* command line tools are hard
2017-01-31 09:09:37 -08:00
David Tolnay
c52e131a03
Replace deprecated MacroInput
2017-01-27 15:42:43 -08:00
David Tolnay
e0d6b9d010
Merge serde_codegen into serde_derive crate
2017-01-25 20:07:55 -08:00
David Tolnay
894a21bc1f
Remove the proc_macro feature gate
2017-01-08 00:11:11 -08:00
David Tolnay
36f07912b8
Remove no-longer-necessary cfg
...
This was fixed in Rust, allowing proc macro crates to be tested.
2016-12-17 17:32:11 -08:00
David Tolnay
a16f07858b
Ask proc_macro_derive to ignore serde attributes
2016-11-15 21:29:34 -05:00
David Tolnay
a9b6cbb8b3
Use post-expansion crate to let other custom derives see serde attrs
2016-10-18 09:00:33 -07:00
Mark Roghelia
ef5d09e144
Rename rustc_macro to proc_macro
...
Fixes #575
2016-10-08 18:29:36 -04:00
David Tolnay
0c18c151e2
Revamp serde_codegen_internals error handling
2016-09-27 00:11:37 -07:00
David Tolnay
c34baa1e5f
No more syntex for serde_derive
2016-09-11 19:55:13 -07:00
David Tolnay
88d845c4d1
Include! test suite for serde_derive
2016-09-01 21:28:40 -07:00
David Tolnay
3c45e5c7a5
Next iteration
2016-08-30 23:55:08 -07:00
David Tolnay
d914fdf67b
Macros 1.1
2016-08-28 22:21:25 -07:00