Commit Graph

322 Commits

Author SHA1 Message Date
Armin Ronacher
ad40f976db Switch to using Content keys internally for flattening to later support arbitrary keys 2018-03-18 21:07:08 +01:00
Armin Ronacher
58d52e784b Remove #[serde(repr = "map")] 2018-03-18 18:30:46 +01:00
Armin Ronacher
d44f12907b Do not emit an in-place deserialization path for struct as map 2018-03-18 18:27:35 +01:00
Armin Ronacher
61b167be9a Attempted support for in_place deserialization for structs as map 2018-03-18 18:22:06 +01:00
Armin Ronacher
ebf80ac965 Implement deserialization support for flatten 2018-03-16 23:05:48 +01:00
Armin Ronacher
9e8cda4c37 Added basic not fully working FlatMapSerializer 2018-03-16 23:05:48 +01:00
Jan Michael Auer
5457394f5b Fixed various issues with combinding flatten and deny_unknown_fields 2018-03-16 23:05:48 +01:00
Jan Michael Auer
6627540dd6 Added support basic deserialization in derive 2018-03-16 23:05:48 +01:00
Jan Michael Auer
5ae06bba49 Store flatten flag in container attributes 2018-03-16 23:05:47 +01:00
Jan Michael Auer
571bb8caed Derive serialization for serde(flatten) 2018-03-16 23:05:47 +01:00
Armin Ronacher
07d07347b3 Make clippy happy 2018-03-16 23:05:22 +01:00
Armin Ronacher
1bd2c6129c Explicitly pass value requirements for the capture path 2018-03-16 23:05:22 +01:00
Armin Ronacher
39413c8ce7 Implement deserializer for map mode and collection fields 2018-03-16 23:05:22 +01:00
Armin Ronacher
b4dbae250b Added support for serialization of structs as maps 2018-03-16 23:05:22 +01:00
David Tolnay
7ad836e6a9
Release 1.0.33 2018-03-15 10:03:42 -07:00
David Tolnay
72ecb9064c
Fix parsing of qself in paths in attributes 2018-03-15 10:02:40 -07:00
David Tolnay
23c6eb3b40
Release 1.0.32 2018-03-13 11:31:26 -07:00
David Tolnay
b8c9a66d75
Release 1.0.31 2018-03-13 10:18:35 -07:00
David Tolnay
69dd3215f4
Release 1.0.30 2018-03-12 11:44:50 -07:00
David Tolnay
0d4d47c398
Release 1.0.29 2018-03-09 00:24:08 -08:00
David Tolnay
30361ac6d0
Clean up workaround that required too many parentheses
The issue has been fixed in the compiler and these extra call site parentheses
are no longer required.
2018-03-09 00:22:27 -08:00
David Tolnay
3f75239bfb
Release 1.0.28 2018-03-08 11:39:32 -08:00
David Tolnay
d6f07f2f47
Ignore redundant_field_names lint 2018-02-27 11:13:26 -08:00
David Tolnay
64573319f9
Meaningful spans when invoking deserializer trait methods 2018-01-10 20:59:48 -08:00
David Tolnay
cc2558b0dc
Meaningful spans when invoking serializer trait methods 2018-01-10 19:22:07 -08:00
David Tolnay
63623eb3b3
Hygiene fixes 2018-01-09 22:22:08 -08:00
David Tolnay
b313f947dc
Use call_site as the span of unnamed member access 2018-01-09 20:28:23 -08:00
David Tolnay
16bc9fb99e
Address clippy lints in serde_derive 2018-01-09 19:40:34 -08:00
David Tolnay
34eaab00f7
Address clippy lints in serde_derive_internals 2018-01-09 19:40:33 -08:00
David Tolnay
ef4dd6c0ec
Update to syn 0.12 2018-01-09 19:05:08 -08:00
David Tolnay
7aeabddd2f
Release 1.0.27 2017-12-30 22:19:41 -05:00
David Tolnay
9cfcd78c87
Release 1.0.26 2017-12-27 17:33:32 -05:00
David Tolnay
ae59c6b6d2
Release 1.0.25 2017-12-23 23:33:59 -05:00
David Tolnay
ee75e6c0e9
Format with rustfmt-nightly 0.3.4 2017-12-23 20:17:52 -08:00
David Tolnay
56d5d7f761
Rename deserialize_from to deserialize_in_place 2017-12-17 10:46:44 -08:00
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
2d465415c5
Take credit 2017-04-20 08:13:46 -07:00
David Tolnay
bc2d637112
Cut an internals release 2017-04-20 08:11: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
6279b0d930
Resolve merge conflicts 2017-04-17 14:25:29 -07:00
David Tolnay
a778425d0f
Merge branch 'origin/master' into 'origin/1.0'
Conflicts:
    serde/Cargo.toml
    serde/src/de/impls.rs
    serde/src/ser/impls.rs
    serde_derive/Cargo.toml
    serde_test/Cargo.toml
2017-04-17 14:18:33 -07:00
David Tolnay
d4d2061a2e
Release 0.9.14 2017-04-17 07:33:45 -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
4f39766211
Fix paths to readme files 2017-04-13 10:37:24 -07:00
David Tolnay
0b7accf86c
Remove unused unstable flag from serde_derive 2017-04-10 17:29:59 -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
8fd41d3b28
Disable publishing 2017-04-05 15:11:47 -07:00
David Tolnay
a7f6ad137a
Merge branch 'master' into '1.0'
Conflicts:
    serde/src/macros.rs
2017-04-05 15:10:18 -07:00
David Tolnay
1b763da529
Release 0.9.13 2017-04-05 15:03:37 -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
59b3961ad4
Release 0.9.12 2017-03-27 15:45:14 -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
dc9445f873
Release 0.9.11 2017-03-05 16:51:44 -08:00
David Tolnay
51ed9c2a40
Release 0.9.10 2017-02-28 12:45:39 -08:00
David Tolnay
59ec931d8f
Release 0.9.9 2017-02-24 13:57:52 -08:00
David Tolnay
017e6d304f
Release 0.9.8 2017-02-21 10:59:42 -08:00
David Tolnay
89cbb81673
Include readme and licenses in crates.io archive
Fixes #772.
2017-02-20 21:11:57 -08: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