Jonas Platte
e4e110e28f
Fix a compile error in derive(Deserialize) with no_std + alloc
2019-05-31 22:16:40 +02:00
David Tolnay
0726623389
Ignore bare_trait_objects lint to support old compilers
2019-05-31 11:34:18 -07:00
Zeyi Fan
4c29eea790
add attribute try_from
2019-05-11 23:31:24 -07:00
David Tolnay
6dd2b4607f
Switch to SPDX 2.1 license expression
2019-05-09 15:21:20 -07:00
David Tolnay
5cc3902ab9
Release 1.0.91
2019-05-06 16:27:04 -07:00
David Tolnay
79a20e9e33
Resolve option_map_unwrap_or_else lint
2019-04-10 22:57:47 -07:00
David Tolnay
0be7f36d51
Release 1.0.90
2019-04-03 09:41:38 -07:00
David Tolnay
4c6cb6e359
Match on serde_path to handle Some(path) and None
...
I find this a bit easier to follow than map + unwrap_or_else.
2019-04-03 09:40:25 -07:00
David Tolnay
82bde8d166
Format with rustfmt 2019-03-27
2019-04-03 09:40:12 -07:00
David Tolnay
f3c6b9f05a
Simplify signature of Container::serde_path
2019-04-03 09:18:45 -07:00
David Tolnay
2f1945eaf2
Refer directly to serde_path in Deserialize impl
...
This makes it not a breaking change if we later want to eliminate
the `use #serde_path as _serde;` line.
2019-04-03 09:16:21 -07:00
Sean Griffin
b4d8a55b2a
Change serde_path
to crate
...
Also changed the generated code to have at least one thing refer to the
path directly, rather than via `use` -- This shows that the impl *can*
work without `use`, but doesn't actually do all the work to remove the
`use` lines unless we decide we need this feature to work on the 2015
edition
2019-03-28 11:42:50 -06:00
Sean Griffin
0e6ce8fa50
Fix for Rust 1.15
2019-03-20 14:31:49 -06:00
Sean Griffin
a295c38ba3
Allow #[serde(serde_path = "...")]
to override extern crate serde
...
This is intended to be used by other crates which provide their own proc
macros and use serde internally. Today there's no consistent way to put
`#[derive(Deserialize)]` on a struct that consistently works, since
crates may be using either `features = ["derive"]` or relying on
`serde_derive` separately.
Even if we assume that everyone is using `features = ["derive"]`,
without this commit, any crate which generates
`#[derive(serde::Deserialize)]` forces its consumers to put `serde` in
their `Cargo.toml`, even if they aren't otherwise using serde for
anything.
Examples of crates which suffer from this in the real world are
tower-web and swirl.
With this feature, it's expected that these crates would have `pub
extern crate serde;` in some accessible path, and add
`#[serde(serde_path = "that_crate::wherever::serde")]` anywhere they
place serde's derives. Those crates would also have to derive
`that_crate::whatever::serde::Deserialize`, or `use` the macros
explicitly beforehand.
The test for this is a little funky, as it's testing this in a way that
is not the intended use case, or even one we want to support. It has its
own module which re-exports all of serde, but defines its own
`Serialize` and `Deserialize` traits. We then test that we generated
impls for those traits, instead of serde's. The only other way to test
this would be to create a new test crate which does not depend on serde,
but instead depends on `serde_derive` and a third crate which publicly
re-exports serde. This feels like way too much overhead for a single
test case, hence the funky test given.
I didn't see anywhere in this repo to document this attribute, so I
assume the docs will have to be done as a separate PR to a separate
repo.
Fixes #1487
2019-03-18 15:20:19 -06:00
David Tolnay
295730ba1e
Clippy cyclomatic complexity lint has been renamed
2019-03-09 16:36:51 -08:00
David Tolnay
b811588fa0
Release 1.0.89
2019-02-28 17:09:10 -08:00
David Tolnay
58bbaa9e80
Refer to Option through serde::export in generated code
2019-02-28 16:36:17 -08:00
Thomas Eizinger
2ea43c8986
Don't generate code with redundant closures
...
Fixes #1491 .
2019-02-28 17:30:21 +11:00
David Tolnay
64c483cf80
Release 1.0.88
2019-02-15 19:55:50 -08:00
David Tolnay
ef9028d798
Remove conflict between flatten and skip
2019-02-15 18:39:15 -08:00
David Tolnay
1668cd19d3
Eliminate try!(..).value to improve rustfmt'd code
...
Rustfmt bails out on the original code, leaving it all on one line.
2019-02-13 09:13:50 -08:00
David Tolnay
134f268cee
Release 1.0.87
2019-02-04 07:08:41 +01:00
David Tolnay
c473633676
Format with rustfmt 2018-12-10
2019-02-04 00:39:32 +01:00
David Tolnay
6a3a82007c
Merge pull request #1474 from jwillbold/master
...
Fixed #1468 , flattened struct fields made structs ignore their tag
2019-02-03 15:37:44 -08:00
Johannes Willbold
1d6ef76cfb
Fixed #1468 , flattened struct fields made structs ignore their tag
2019-02-03 02:09:37 +01:00
David Tolnay
c8e3959435
Release 1.0.86
2019-02-01 21:07:19 -08:00
David Tolnay
fa854a2108
Format with rustfmt 2018-12-10
2019-02-01 21:04:08 -08:00
David Tolnay
bb99b31eb0
Release 1.0.85
2019-01-18 22:36:49 -08:00
David Tolnay
84397183f3
Fix spelling of alises -> aliases
2019-01-18 22:34:23 -08:00
David Tolnay
aeae265777
Simpler way to get single element from vector
2019-01-18 22:33:43 -08:00
David Tolnay
a9c5df5da1
Remove unused Clone on attr::Attr
2019-01-18 22:31:25 -08:00
Lymia Aluysia
8bbc2995ca
Fix clippy lint in serde_derive
2019-01-15 11:35:26 -06:00
Lymia Aluysia
7d3872df57
Fix compilation on Rust 1.15.x
2019-01-15 11:29:55 -06:00
Lymia Aluysia
1ed228b92b
Implements alias annotation and allow multiple deserialization renames.
2019-01-15 11:15:01 -06:00
David Tolnay
fea4e8e5b6
Release 1.0.84
2018-12-31 23:45:34 -05:00
David Tolnay
11cc7014b3
Set all doc tests to 2018 edition
2018-12-31 23:22:13 -05:00
David Tolnay
054ab1adaf
Update serde documentation to 2018 edition
2018-12-31 23:22:11 -05:00
David Tolnay
2f36b26a5c
Clarify that these lints are ignored
2018-12-31 22:49:38 -05:00
David Tolnay
9b4edb3a1d
Address match_ref_pats lint in serde_derive
2018-12-31 22:47:48 -05:00
David Tolnay
b8adc5ffa2
Update name of stutter lint in serde_derive
2018-12-31 22:47:18 -05:00
David Tolnay
bd90cafda7
Ignore trivially_copy_pass_by_ref lint in serde_derive
2018-12-31 22:47:03 -05:00
David Tolnay
eb7250792b
Format with rustfmt 2018-12-10
2018-12-28 12:19:32 -05:00
David Tolnay
7e5066b878
Merge pull request #1450 from motu42/master
...
Bug fix to support the tag attribute on braced structs with zero fields
2018-12-27 21:48:14 -05:00
Johannes Willbold
889e17816f
Bug fix for #1449
...
Modified serialize_struct_as_struct.
Added test test_internally_tagged_braced_struct_with_zero_fields
2018-12-28 02:50:24 +01:00
David Tolnay
b1b9702daf
Release 1.0.83
2018-12-27 19:53:48 -05:00
David Tolnay
32728d2f1d
Format with rustfmt 2018-12-10
2018-12-27 19:52:26 -05:00
David Tolnay
794ee15386
Merge pull request #1448 from motu42/master
...
Allow #[serde(tag="...")] on structs
2018-12-27 19:47:28 -05:00
Johannes Willbold
2359417804
Added ui tests, Limited serde(tag = "...") to structs with named field
...
Added ui test struct-representation/internally-tagged-unit
Added ui test struct-representation/internally-tagged-tuple
Limited the serde(tag = "...") to enums and structs with named field
2018-12-28 01:29:33 +01:00
David Tolnay
7950f3cdc5
Format with rustfmt 2018-12-10
2018-12-27 15:35:43 -05:00
David Tolnay
b87f8f35ee
Merge pull request 1447 from vincascm/master
2018-12-27 15:29:16 -05:00
Johannes Willbold
9e53405f43
Fix for rustc 1.15.0
2018-12-27 21:21:46 +01:00
David Tolnay
c6c1d8fa86
Work around deprecation of str::trim_left_matches
2018-12-27 15:20:32 -05:00
Johannes Willbold
414fd694c0
Allowed serde(tag="...") on structs
...
Added test test_internally_tagged_struct
Renamed EnumTag to TagType as it now also used for structs
Modified serialize_struct_as_struct
2018-12-27 20:18:36 +01:00
vinoca
7e82809592
Fix tests fail since modify Container attributes rename_all
2018-12-20 14:30:23 +08:00
vinoca
0dae5db30e
Support Container attributes rename_all only for Serialize or Deserialize
2018-12-19 09:46:52 +08:00
David Tolnay
5c24f0f0f3
Clean up some indentation that isn't visible to rustfmt
2018-12-10 22:31:39 -08:00
David Tolnay
c2591e9b39
Release 1.0.82
2018-12-10 22:25:27 -08:00
David Tolnay
16daba8ea9
Format with rustfmt 2018-11-30
2018-12-10 22:09:34 -08:00
David Tolnay
85fbd8793a
Support default attr in deserialize_seq_in_place
2018-12-10 22:09:31 -08:00
Tim Ryan
385a385c62
Adds support for the default attr to tuple variants in enums.
2018-12-11 00:02:50 -05:00
David Tolnay
e1edb0282a
Release 1.0.81
2018-12-07 18:30:35 -08:00
hcpl
034db9f20f
Improve overall quality of compile_error!
errors
...
Also updates UI tests.
2018-11-30 02:51:49 +02:00
hcpl
8f3f073017
Use more spans for error messages
2018-11-25 16:44:41 +02:00
David Tolnay
58b3af4c29
Copyright/license headers
...
The following changes are included:
- Delete per-file license notices at the top of each file.
- Delete the first paragraph of LICENSE-MIT (an inaccurate
pseudo-copyright line), leaving only the text of the MIT license.
Nothing about the license of Serde code has changed, only our
understanding of how to correctly communicate that license has changed.
This mirrors an equivalent change being applied in the rust-lang/rust
repository.
2018-11-24 15:53:09 -08:00
David Tolnay
9afc5fef11
Format with rustfmt 1.0.0-nightly
2018-11-21 01:13:17 -08:00
David Tolnay
451ee2d78e
Clean up calls to into_iter per into_iter_on_ref lint
2018-11-10 20:10:37 -08:00
David Tolnay
1b45e5766a
Release 1.0.80
2018-10-14 03:08:53 -07:00
David Tolnay
6d58492ad0
Fix links to redirected derive documentation
2018-10-03 23:14:49 -07:00
Richard Dodd
80765eb453
Make suggested changes
2018-09-30 15:17:47 +01:00
Richard Dodd
f1073dca04
Make the recommended changed from code review.
2018-09-30 12:34:52 +01:00
Richard Dodd
da65fe5a52
Some docs
2018-09-29 15:06:23 +01:00
David Tolnay
9956589ed5
Release 1.0.79
2018-09-15 14:40:38 -07:00
David Tolnay
81a3f66d78
Ignore unseparated_literal_suffix pedantic lint
2018-09-11 23:08:13 -07:00
David Tolnay
a8247bc619
Sort the ignored lints in serde_derive
2018-09-11 23:08:00 -07:00
David Tolnay
66a9ccb10e
Ignore renamed_and_removed_lints lint
...
The recommended replacement involving clippy::all has not been
stabilized yet.
2018-09-11 23:05:33 -07:00
David Tolnay
53fe1b328e
Format with rustfmt 0.99.4
2018-09-11 23:00:08 -07:00
roblabla
dcd2232f69
Enforce unit struct for #[serde(other)]
2018-09-11 17:12:37 +00:00
roblabla
61bf901048
Fix for rust 1.15
2018-09-10 17:12:33 +00:00
roblabla
8cc7e6aa90
Implement #serde(other) on enum variant
2018-09-10 15:12:15 +00:00
David Tolnay
7b50388fef
Release 1.0.78
2018-09-08 17:10:41 -07:00
David Tolnay
108cca687c
Release 1.0.77
2018-09-06 21:36:27 -07:00
David Tolnay
b49bd52a53
Use parse_macro_input to report parse errors
2018-09-06 21:16:12 -07:00
David Tolnay
27bd640812
Update to syn 0.15
2018-09-06 21:16:08 -07:00
David Tolnay
98eddf9b29
Update to syn 0.15-rc1
2018-09-01 23:03:59 -07:00
David Tolnay
d23a40c1bb
Format with rustfmt 0.99.2
2018-09-01 23:03:41 -07:00
David Tolnay
55cecace29
Release 1.0.76
2018-09-01 15:25:53 -07:00
David Tolnay
2aab0ce2f6
Release 1.0.75
2018-08-24 23:03:04 -04:00
Eh2406
6c45593ee4
update a deb for minimal-versions
2018-08-24 22:50:17 -04:00
David Tolnay
cfdbbee845
Release 1.0.74
2018-08-23 18:29:16 -04:00
David Tolnay
db6aaf5110
Release 1.0.73
2018-08-22 21:47:15 -04:00
David Tolnay
dc4bb0bf08
Trim the r# from raw identifiers in user-facing strings
2018-08-22 20:50:29 -04:00
David Tolnay
60cbbacdb3
Release 1.0.72
2018-08-20 21:02:03 -04:00
David Tolnay
11c5fd78ad
Abbreviate and touch up some attribute parsing comments
2018-08-14 22:37:59 -07:00
David Tolnay
cbfdba3826
Use rustfmt to wrap and format comments
2018-08-14 22:32:27 -07:00
David Tolnay
a065db9838
Add AppVeyor badge to rest of crates
2018-08-07 00:15:12 -07:00
David Tolnay
24c4df7831
Release 1.0.71
2018-08-06 23:55:55 -07:00
David Tolnay
28db9d4989
Format with rustfmt 0.99.1
2018-08-06 22:40:28 -07:00
David Tolnay
4e54aaf796
Format with rustfmt 0.8.2
2018-07-08 19:02:44 -07:00
David Tolnay
4cddcbe194
Release 1.0.70
2018-07-06 20:21:26 -07:00
David Tolnay
3bcd568c86
Release 1.0.69
2018-06-30 23:40:28 -07:00
David Tolnay
a916aa9420
Release 1.0.68
2018-06-28 09:31:12 -07:00
Josh Chase
41dcb969e8
Shut clippy up
2018-06-28 11:12:27 -04:00
Josh Chase
6dbaea34ba
Suppress 'extern crate' warning for rust 2018
2018-06-28 10:51:57 -04:00
David Tolnay
ce17301b8b
Release 1.0.67
2018-06-27 00:18:03 -07:00
David Tolnay
d827b101d9
Resolve default_trait_access lint
2018-06-26 23:58:02 -07:00
David Tolnay
c45ab6b304
Ignore indexing_slicing pedantic lint
2018-06-26 23:56:39 -07:00
David Tolnay
a887db398b
Release 1.0.66
2018-06-03 11:45:20 -07:00
David Tolnay
57de28744c
These match-expressions are implementing unwrap_or_else
2018-06-02 22:09:04 -07:00
David Tolnay
6d31ec521b
Remove leftover import from compile_error change
2018-06-02 22:01:45 -07:00
David Tolnay
7ad3d17e59
Merge pull request #1297 from adamcrume/master
...
Use compile_error! instead of panicking
2018-06-02 22:00:24 -07:00
Adam Crume
05e931b9a5
Update tests and use quote! macro
2018-06-02 21:11:42 -07:00
David Tolnay
2db2b53bbf
Release 1.0.65
2018-06-01 13:00:58 -07:00
Adam Crume
993710eb16
Use compile_error! instead of panicking
...
Fixes #1168
2018-05-31 19:57:23 -07:00
David Tolnay
dbaf2893e3
Release 1.0.64
2018-05-30 00:17:45 -07:00
David Tolnay
1b6fbf1023
Release 1.0.63
2018-05-28 20:12:08 -07:00
David Tolnay
c50c9d8862
Simplify readme as rendered on crates.io
2018-05-27 19:18:30 -07:00
David Tolnay
983bf8c090
Release 1.0.62
2018-05-26 18:59:03 -07:00
David Tolnay
7407d71417
Release 1.0.61
2018-05-26 10:38:18 -07:00
David Tolnay
1385aac208
Release 1.0.60
2018-05-25 16:05:01 -07:00
David Tolnay
06dcbbbaba
Format with rustfmt 0.7.0
2018-05-22 21:27:37 -07:00
David Tolnay
4de20bd48d
Release 1.0.59
2018-05-21 03:51:32 -07:00
David Tolnay
6bbc415fdf
Resolve conflicts between transparent and proc-macro2 upgrade
2018-05-20 21:57:23 -07:00
David Tolnay
ac1b25e91d
Improve error messages related to transparent
2018-05-20 21:55:48 -07:00
David Tolnay
0a4d536253
Implement transparent deserialize
2018-05-20 21:55:20 -07:00
David Tolnay
7dba1e303d
Implement transparent serialize
2018-05-20 21:55:19 -07:00
David Tolnay
0ea9d73fdf
Validate use of serde(transparent)
2018-05-20 21:55:18 -07:00
David Tolnay
a64aaeeb3b
Parse serde(transparent) container attribute
2018-05-20 21:55:16 -07:00
David Tolnay
3d5141a2f1
Update to proc-macro2 0.4
2018-05-20 20:55:14 -07:00
David Tolnay
656ea96c65
Remove reminders about flatten in a sequence
2018-05-20 12:42:40 -07:00
David Tolnay
5302482596
Simplify deserialize_seq_in_place
2018-05-20 12:40:35 -07:00
David Tolnay
7ada27014d
Track field index in internal AST
2018-05-20 12:40:28 -07:00
David Tolnay
4fa2a50f62
Format with rustfmt 0.7.0
2018-05-19 17:33:30 -07:00
David Tolnay
0c5f20c148
Release 1.0.58
2018-05-19 17:30:39 -07:00
David Tolnay
16d1265e17
Fix generated code for deserializing untagged newtype variant
2018-05-19 17:20:14 -07:00
David Tolnay
3b4803115b
Release 1.0.57
2018-05-18 23:31:33 -07:00
David Tolnay
f58000cb41
Release 1.0.56
2018-05-18 12:37:06 -07:00
David Tolnay
6550231a51
Release 1.0.55
2018-05-12 09:47:43 -07:00
David Tolnay
d6b62b9417
Release 1.0.54
2018-05-11 23:02:37 -07:00
David Tolnay
f3f26796c7
Format with rustfmt 0.6.1
2018-05-10 09:11:19 -07:00
David Tolnay
d1460e1f0d
Release 1.0.53
2018-05-10 08:44:53 -07:00
David Tolnay
368961e961
Support deserializing flattened untagged enum
2018-05-10 08:33:47 -07:00
David Tolnay
f9c6f0ab62
Release 1.0.52
2018-05-09 13:01:41 -07:00
David Tolnay
b2b36e1764
Accept implicitly borrowed data inside of Option
2018-05-08 12:19:09 -07:00
David Tolnay
4ad140ea70
Improve error for struct deserialized from array that is too short
2018-05-08 12:03:35 -07:00
David Tolnay
67777eb585
Account for skip_serializing_if in tuple struct length
2018-05-08 11:49:37 -07:00
David Tolnay
b4e51fcc77
Respect skip_serializing in tuple structs and variants
2018-05-08 11:37:52 -07:00
David Tolnay
be7fe2a5eb
Introduce bound attribute on enum variants
2018-05-08 11:16:10 -07:00
David Tolnay
b4076f4577
Release 1.0.51
2018-05-08 10:07:45 -07:00
David Tolnay
c4181f46be
Respect variant skip attribute in inferred bounds
2018-05-07 21:30:00 -07:00
David Tolnay
8c0efc3d77
Add a variant skip attribute
2018-05-07 21:27:34 -07:00
David Tolnay
7e3efaf6c5
Improve error when a 'de lifetime parameter already exists
2018-05-07 21:15:44 -07:00
David Tolnay
12fe42ed45
Support empty adjacently tagged enum
2018-05-07 21:02:42 -07:00
David Tolnay
7cd4f49c76
Release 1.0.50
2018-05-07 13:51:32 -07:00
David Tolnay
0025ef9aba
Detect deserialize on a struct ending in dynamically sized slice
2018-05-07 11:52:59 -07:00
David Tolnay
536bdd77a0
Release 1.0.49
2018-05-07 11:51:15 -07:00
David Tolnay
dc921892be
Eliminate map_or(None, f)
2018-05-07 11:23:04 -07:00
David Tolnay
62557731c3
Enable pedantic clippy lints in serde_derive
2018-05-07 11:03:09 -07:00
David Tolnay
30824e9f61
Release 1.0.48
2018-05-07 10:22:26 -07:00
David Tolnay
6475e73b05
Less horrible logic for missing fields that unconditionally return error
2018-05-06 22:20:35 -07:00
David Tolnay
3cd9d071c2
Fix adjacently tagged empty tuple variant or struct variant
2018-05-06 21:50:40 -07:00
David Tolnay
9dc05c36f0
Release 1.0.47
2018-05-06 21:39:21 -07:00
David Tolnay
94b857057b
Support deserializing enums containing flatten
2018-05-06 20:41:02 -07:00
David Tolnay
979df3427b
Support serializing enums containing flatten
2018-05-06 20:14:35 -07:00
David Tolnay
978d64993e
Allow flatten attribute in enums
2018-05-06 20:14:28 -07:00
David Tolnay
5098609935
Release 1.0.46
2018-05-06 13:44:55 -07:00
David Tolnay
6374467f02
Merge pull request #1245 from serde-rs/flat
...
Support deserializing a flattened internally tagged enum
2018-05-06 13:43:44 -07:00
David Tolnay
3859f58d9b
Move derive internals into serde_derive crate
...
We can continue to publish serde_derive_internals independently but
serde_derive no longer has a dependency on it. This improves compile
time of serde_derive by 7%.
2018-05-05 23:46:30 -07:00
David Tolnay
aac1c65033
Simplify implementation of flattened internally tagged enum
...
The fact that the tag entry is consumed was only observable if there is
a later flattened map field, at which point the behavior is already
confusing anyway.
#[derive(Deserialize)]
struct Example {
#[serde(flatten)]
a: InternallyTagged,
#[serde(flatten)]
rest: BTreeMap<String, Value>,
}
Before this simplification the map would receive all the fields of the
internally tagged enum but not its tag, after it receives all the fields
including the tag.
2018-05-05 22:30:46 -07:00
David Tolnay
d8120e19bc
Support deserializing a flattened internally tagged enum
2018-05-05 21:52:16 -07:00
David Tolnay
f263e3fcec
Format serde_derive generated where-clauses
2018-05-05 18:24:16 -07:00
David Tolnay
47676cdb49
Clean up references to Ident
2018-05-05 00:45:30 -07:00
David Tolnay
93bddb361e
Fix toplevel_ref_arg lint
2018-05-05 00:39:26 -07:00
David Tolnay
adb1c9540d
Remove a layer of wrapping in deserialize_with untagged newtype variant
2018-05-05 00:25:27 -07:00
David Tolnay
0e1d065402
Format with rustfmt 0.6.1
2018-05-05 00:18:21 -07:00
David Tolnay
8c3b52e308
Remove a layer of wrapping in deserialize_with newtype struct
2018-05-05 00:17:00 -07:00
David Tolnay
3f0d3453d8
Release 1.0.45
2018-05-02 15:18:17 -07:00
David Tolnay
b78f434086
Pretend remote derives are not dead code
2018-05-02 14:23:59 -07:00
David Tolnay
893c0578dd
Release 1.0.44
2018-05-01 22:34:27 -07:00
David Tolnay
cb2b92f828
Handle flatten + deserialize_with
2018-05-01 22:25:06 -07:00
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
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