Commit Graph

322 Commits

Author SHA1 Message Date
David Tolnay
47a4ffbd31
Fill in missing fully qualified paths in flatten 2018-05-01 22:24:25 -07:00
David Tolnay
d82d1707d6
Format with rustfmt 0.6.0 2018-04-30 01:42:46 -07:00
David Tolnay
89278996c5
Release 1.0.43 2018-04-23 11:23:58 -07:00
Igor Gnatenko
f3cb7c7a32
derive: bump min version of quote to 0.5.2
Fixes: https://github.com/serde-rs/serde/issues/1230
2018-04-22 09:22:47 +02:00
David Tolnay
af795e2e54
Release 1.0.42 2018-04-21 15:16:10 -07:00
David Tolnay
df93fab5fa
Reduce instantiations of Result::map in Deserialize of unit variants
This eliminates 110 instantiations of Result::map in Xi and reduces
binary size by 229 kilobytes.
2018-04-21 13:27:17 -07:00
David Tolnay
6d1807bb4a
Improve Serialize of adjacently tagged newtype variants
The existing implementation was unnecessarily complicated.

    struct __AdjacentlyTagged<'__a> {
        data: (&'__a String,),
        phantom: _serde::export::PhantomData<AdjacentlyTagged>,
    }
    impl<'__a> _serde::Serialize for __AdjacentlyTagged<'__a> {
        fn serialize<__S>(
            &self,
            __serializer: __S,
        ) -> _serde::export::Result<__S::Ok, __S::Error>
        where
            __S: _serde::Serializer,
        {
            let (__field0,) = self.data;
            _serde::Serialize::serialize(__field0, __serializer)
        }
    }
    _serde::ser::SerializeStruct::serialize_field(
        &mut __struct,
        "content",
        &__AdjacentlyTagged {
            data: (__field0,),
            phantom: _serde::export::PhantomData::<AdjacentlyTagged>,
        },
    )?;

Instead the new implementation does simply:

    _serde::ser::SerializeStruct::serialize_field(
        &mut __struct,
        "content",
        __field0,
    )?;
2018-04-21 11:41:39 -07:00
David Tolnay
b37cf858ce
Remove unneeded quote_spanned that uses call_site 2018-04-21 11:33:39 -07:00
David Tolnay
5f8fa33756
Quote's default has changed to call_site 2018-04-21 11:33:38 -07:00
David Tolnay
607966dcf7
Fix error message type inference in compile-fail/remote/wrong_de.rs 2018-04-21 11:21:13 -07:00
David Tolnay
6a8c39b2aa
More efficient try!() alternative 2018-04-21 10:53:13 -07:00
David Tolnay
382f3c2771
Release 1.0.41 2018-04-19 22:13:45 -07:00
David Tolnay
541f9180cf
Release 1.0.40 2018-04-19 10:31:33 -07:00
David Tolnay
184264ee92
Release 1.0.39 2018-04-17 11:35:45 -07:00
David Tolnay
8d113e67d6
Release 1.0.38 2018-04-14 20:30:18 -07:00
David Tolnay
6e206ce053
Name formatter args with a leading double underscore 2018-04-13 00:21:21 -07:00
David Tolnay
47fc9af472
Emit borrowed methods only if collect_other_fields
Without collect_other_fields, the visit_borrowed_str and
visit_borrowed_bytes implementations that were being generated were
identical to their default implementation of forwarding to visit_str and
visit_bytes.
2018-04-13 00:17:34 -07:00
David Tolnay
1651f86d56
Simplify Option that is always Some 2018-04-13 00:17:30 -07:00
David Tolnay
1157ac0118
Eliminate unnecessary braces in wrap_deserialize_variant_with 2018-04-12 23:48:38 -07:00
David Tolnay
202c10147e
Fix deserialize_with on a struct variant with one field 2018-04-12 23:44:53 -07:00
David Tolnay
9f38ca032e
Format with rustfmt 0.4.1 2018-04-12 23:04:47 -07:00
David Tolnay
00178ba795
Eliminate generic functions in bound.rs 2018-04-12 22:48:31 -07:00
David Tolnay
24700ebeb6
Move associated type search into with_bounds 2018-04-12 22:46:53 -07:00
David Tolnay
f06001c086
Name type_params consistently with Syn 2018-04-12 22:04:34 -07:00
David Tolnay
ec773fb7db
Make use of Generics::type_params iterator 2018-04-12 22:03:40 -07:00
David Tolnay
da8b457f66
Simplify with_where_predicates_from_fields 2018-04-12 21:47:08 -07:00
Osspial
629bf7b354 Fix clippy warnings 2018-04-12 18:40:06 -04:00
Osspial
4415d10c61 Fix associated types only working for first generic parameter
Also, removes extraneous `where for`
2018-04-12 16:44:34 -04:00
Osspial
2e824e9aba Limit type bounds to associated types 2018-04-10 10:53:37 -04:00
Osspial
fd14332729 Ignore skipped fields 2018-04-09 23:57:20 -04:00
Osspial
c413775574 Add partially-working where bounds for associated types 2018-04-09 23:22:18 -04:00
David Tolnay
eed18ffab2
Release 1.0.37 2018-04-01 22:30:32 -07:00
David Tolnay
f8e1fa8ebc
Use Generics::make_where_clause helper 2018-04-01 22:25:50 -07:00
David Tolnay
ba002e1119
Update signature of Lifetime::new 2018-03-31 23:46:25 +02:00
David Tolnay
8b44eb8bfc
Add parens to TraitBound 2018-03-31 23:45:30 +02:00
David Tolnay
d82a0cc5ff
Remove use of Span::located_at 2018-03-31 23:44:50 +02:00
Alex Crichton
b1c1d964e1 Update to syn/quote/proc-macro2 new apis 2018-03-29 00:54:05 -07:00
David Tolnay
d2b65e0a5d
Prefer call site spans 2018-03-28 10:49:30 +02:00
David Tolnay
7c04c98e0e
Release 1.0.36 2018-03-27 11:35:45 +02:00
David Tolnay
23e2e92237
Release 1.0.35 2018-03-25 12:59:02 +02:00
David Tolnay
c1602a4d76
Deserialize map in place cannot have flatten attributes 2018-03-25 12:42:36 +02:00
David Tolnay
c23be3f855
Revert flatten change in deserialize in place 2018-03-25 12:39:20 +02:00
David Tolnay
e5ed440136
Always check flatten assertions 2018-03-25 12:32:06 +02:00
David Tolnay
2b18b57d84
Release 1.0.34 2018-03-22 15:06:21 -07:00
Armin Ronacher
e4ef087735 Added support for borrowing when flattening 2018-03-20 15:19:36 +01:00
Armin Ronacher
695c3eedcb Do not imply flatten from skip_serialize 2018-03-20 14:45:14 +01:00
Armin Ronacher
50c636a923 Remove now dead as_map detection (can be cattrs.has_flatten) 2018-03-20 13:43:23 +01:00
Armin Ronacher
5b884b5bf9 Added some missing UFCs 2018-03-20 13:38:22 +01:00
Armin Ronacher
abeea89147 Fully qualify some calls in generated code and fix a bad comment 2018-03-20 13:35:16 +01:00
Armin Ronacher
f02dbf381b Added non string key support for flattening 2018-03-19 00:57:58 +01:00
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