David Tolnay
4687c1b52b
Test Weak deserialize impls
2018-05-07 11:23:18 -07:00
David Tolnay
a58abae193
Test Weak serialize impls
2018-05-07 11:23:17 -07:00
David Tolnay
eecc0870fc
Test for pub(restricted)
2018-05-06 23:22:27 -07:00
David Tolnay
3cd9d071c2
Fix adjacently tagged empty tuple variant or struct variant
2018-05-06 21:50:40 -07:00
David Tolnay
972cc06fed
Format the flatten tests using rustfmt 0.6.1
2018-05-06 21:38:41 -07:00
David Tolnay
2009b4da5f
Remove old flatten in enum compile-fail test
2018-05-06 21:26:40 -07:00
David Tolnay
0b72c86a35
Add tests for flatten in enums
2018-05-06 21:23:20 -07:00
David Tolnay
d8120e19bc
Support deserializing a flattened internally tagged enum
2018-05-05 21:52:16 -07:00
David Tolnay
97eff8e875
Format with rustfmt 0.6.1
2018-05-05 00:56:12 -07:00
David Tolnay
b78f434086
Pretend remote derives are not dead code
2018-05-02 14:23:59 -07:00
David Tolnay
cb2b92f828
Handle flatten + deserialize_with
2018-05-01 22:25:06 -07:00
David Tolnay
d82d1707d6
Format with rustfmt 0.6.0
2018-04-30 01:42:46 -07:00
David Tolnay
bceda5fb18
Unpack a layer of NewtypeStruct when content is newtype
2018-04-23 11:04:42 -07:00
David Tolnay
3c4961c48e
Lenient byte and string deserialization from buffered content
2018-04-19 10:21:55 -07:00
David Tolnay
202c10147e
Fix deserialize_with on a struct variant with one field
2018-04-12 23:44:53 -07: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
def8d6e8af
Add associated type test
2018-04-10 11:16:32 -04:00
David Tolnay
860241aa88
Merge pull request #1205 from mitsuhiko/bugfix/tuple-struct-flatten
...
Produce error message for use of flatten in tuple structs
2018-04-02 07:09:39 +02:00
Armin Ronacher
77376f39ea
Produce error message for use of flatten in tuple structs
2018-04-01 22:11:21 +02:00
Armin Ronacher
302fac91a3
Produce error message for use of flatten within struct variant
2018-04-01 22:01:24 +02:00
David Tolnay
42430902e2
Special case remote = "Self"
2018-03-27 10:56:05 +02:00
David Tolnay
5c9c97c0ce
Remove test that fails to parse flatten attribute
2018-03-25 12:33:50 +02:00
Armin Ronacher
3d647f4063
Fixed a compilefail test for flatten on enums
2018-03-20 23:26:22 +01:00
Armin Ronacher
27f935f036
Correctly serialize newtype variants for flatten
2018-03-20 23:05:05 +01:00
Armin Ronacher
99614c7266
Added flatten on enum compile fail test
2018-03-20 22:15:47 +01:00
Armin Ronacher
bb2ecb3bc4
Added compilefail tests for flatten conflicts
2018-03-20 22:04:12 +01:00
Armin Ronacher
e4ef087735
Added support for borrowing when flattening
2018-03-20 15:19:36 +01:00
Armin Ronacher
8637dda60f
Refactored a test
2018-03-20 13:38:08 +01:00
Armin Ronacher
f02dbf381b
Added non string key support for flattening
2018-03-19 00:57:58 +01:00
Armin Ronacher
7cf184624a
Use more consistent error messages for bad flattening
2018-03-18 23:46:28 +01:00
Armin Ronacher
c5a3128492
Added a more complex flattening test
2018-03-18 23:01:13 +01:00
Armin Ronacher
58d52e784b
Remove #[serde(repr = "map")]
2018-03-18 18:30:46 +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
f1af2dc5ab
Added support for newtype variant serialization
2018-03-18 13:10:54 +01:00
Armin Ronacher
ebc61baab2
Added newtype struct support for flattening
2018-03-18 13:02:00 +01:00
Armin Ronacher
ffcde25b6e
Fixed some clippy warnings
2018-03-17 00:49:00 +01:00
Armin Ronacher
b8602a7e43
Added test for tag/content enum flattening
2018-03-16 23:05:48 +01:00
Armin Ronacher
a8c8c2028e
Added support for struct variant enum serialization
2018-03-16 23:05:48 +01:00
Armin Ronacher
b4ef7ac323
Updated tests for flatten
2018-03-16 23:05:48 +01:00
Armin Ronacher
583c0d8d14
Make proc-macro2/nightly happy
2018-03-16 23:05:22 +01:00
Armin Ronacher
77b07f3fbf
Added tests for unknown_fields_into
2018-03-16 23:05:22 +01:00
David Tolnay
72ecb9064c
Fix parsing of qself in paths in attributes
2018-03-15 10:02:40 -07: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
f288a41768
Test the new errors on conflicting enum tags
2018-03-08 09:31:25 -08:00
David Tolnay
d6f07f2f47
Ignore redundant_field_names lint
2018-02-27 11:13:26 -08:00
David Tolnay
9db784bccd
Ignore decimal_literal_representation in test suite
2018-01-29 21:52:21 -08:00
David Tolnay
1bdf5ecec4
Ignore unused_parens warning on the proc macro workaround
2018-01-21 17:54:06 -08:00
David Tolnay
6e01f220b1
Ignore clippy flagging our workaround
2018-01-13 14:28:12 -08:00
Martin Lindhe
ae0373643c
fix some typos
2018-01-03 15:16:45 +01:00
David Tolnay
ed6a1de311
Auto format attributes on their own line
2017-12-23 20:24:57 -08:00
David Tolnay
ee75e6c0e9
Format with rustfmt-nightly 0.3.4
2017-12-23 20:17:52 -08:00
David Tolnay
0dac13e4db
Resolve conflict with pr 1115
2017-12-11 20:59:54 -08: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
David Tolnay
e0eea551b4
Fix missing absolute paths in deserialize_seq
2017-11-29 19:45:22 -08:00
David Tolnay
436cafb0a3
Catch wrong field names length in serde_test
2017-11-12 10:16:43 -08:00
David Tolnay
9e7a3437d9
Allow internally tagged newtype variant containing unit struct
2017-11-06 23:32:36 -08:00
David Tolnay
f6ac232580
Merge pull request #1084 from Marwes/serde_test_readable_
...
Add an API for making tests for readable/compact representations
2017-11-06 22:05:29 -08:00
Markus Westerlind
aad7a7987f
Add an example to the Configure trait
2017-11-06 10:35:22 +01:00
David Tolnay
6437167930
Merge pull request #1083 from serde-rs/ty-macro
...
Fix bounds for macro named the same as a type parameter
2017-11-05 12:56:57 -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
40db31691a
Allow borrow attribute on newtype variants
2017-11-05 12:10:40 -08:00
David Tolnay
d5e5c520ac
Ignore skipped fields when looking for borrowed lifetimes
2017-11-03 10:08:02 -07:00
David Tolnay
2a557a1e36
Clippy false positive on needless_lifetimes has been fixed
2017-10-31 22:42:53 -07:00
David Tolnay
ab0848f780
Follow clippy advice about unreadable literal
2017-10-31 22:42:12 -07:00
David Tolnay
9b08915a18
Add tests for std::num::Wrapping impls
2017-10-31 09:32:58 -07:00
David Tolnay
aa03fd5d1a
Duplicate error messages have been fixed
2017-10-27 21:08:41 -04:00
David Tolnay
e198afb0c1
Add missing copyright notices
2017-10-22 16:01:19 -07:00
David Tolnay
9be3d32016
Remove redundant readable/compact tests
...
This functionality is covered well enough by the std::net types.
2017-10-17 23:16:21 -07:00
David Tolnay
5daf1b89a1
Consolidate readable/compact deserialization tests
2017-10-17 23:15:35 -07:00
David Tolnay
f8f5d0ca2f
No need for readable setting for the ignore test
2017-10-17 23:09:50 -07:00
David Tolnay
4ed0362c8e
Panic by default in serde_test is_human_readable
...
The serde_test Serializer and Deserializer panic in is_human_readable unless the
readableness has been set explicitly through one of the hidden functions. This
is to force types that have distinct readable/compact representations to be
tested explicitly in one or the other, rather than with a plain assert_tokens
which arbitrarily picks one.
We need to follow up by designing a better API in serde_test to expose this
publicly. For now serde_test cannot be used to test types that rely on
is_human_readable. (The hidden functions are meant for our test suite only.)
2017-10-17 09:49:42 -07:00
David Tolnay
030459a040
Merge pull request #1044 from Marwes/human_readable
...
Serialize to binary if the serde format is not human readable
2017-10-15 16:39:58 -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
Markus Westerlind
e36915300f
Properly deserialize non-readable IpAddr and SocketAddr
2017-09-14 17:08:17 +02:00
Markus Westerlind
85c05d301a
Fix the non-readble IpAddr serialize implementations
2017-09-11 17:40:02 +02:00
Markus Westerlind
ad3335e5d6
Serialize non-human-readble ip addresses as tuples
...
Since we know exactly how many bytes we should serialize as we can hint
to the serializer that it is not required which further reduces the
serialized size when compared to just serializing as bytes.
2017-09-11 15:54:53 +02: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
8a630fea7c
Suppress cast_lossless lint in test suite
2017-09-09 11:08:19 -07:00
David Tolnay
2e597ed3f0
Remove unused functions in with-variant tests
...
Macro expansion fails before it would generate code to call any of these.
2017-09-09 10:58:32 -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
David Tolnay
e47284c0e0
Merge pull request #1043 from greyblake/screaming-kebab-case
...
SCREAMING-KEBAB-CASE support
2017-09-08 21:30:01 -07:00
Markus Westerlind
0dccbb1f11
Serialize to binary if the serde format is not human readable
...
This implements the KISS suggested in https://github.com/serde-rs/serde/issues/790 .
It is possible that one of the other approaches may be better but this
seemed like the simplest one to reignite som discussion.
Personally I find the original suggestion of adding two traits perhaps slightly
cleaner in theory but I think it ends up more complicated in the end
since the added traits also need to be duplicated to to the `Seed`
traits.
Closes #790
2017-09-07 16:20:57 +02:00
Steven Fackler
95407a4ca5
Support field ident deserialization from u32
2017-09-05 21:55:33 -07:00
Sergey Potapov
e67d941b78
Support for SCREAMING-KEBAB-CASE
2017-09-05 22:07:08 +02:00
David Tolnay
972da59ebc
Deserialize unsized Arc and Rc
2017-09-04 10:56:42 -07:00
David Tolnay
e4ea2a56e9
Serialize unsized Arc and Rc
2017-09-04 10:31:03 -07:00
Michael Smith
552971196d
Fix Clippy errors in variant serialize_with tests
2017-08-16 12:04:39 -07:00
David Tolnay
0681cd5003
Replace deprecated compiletest::default_config()
2017-08-15 22:10:18 -07:00
David Tolnay
d965367238
No longer need feature(into_boxed_c_str)
2017-08-15 22:08:23 -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
f36a1e0895
Inherit the visibility of remote struct definition
2017-07-25 23:52:06 -07:00
Markus Westerlind
85bccf42b6
Fix SystemTime serialization test on Windows
...
Windows's `SystemTime` do not have nanosecond resolution which caused the test duration to be truncated b1363a73ed/src/libstd/sys/windows/time.rs (L177)
2017-07-16 12:16:07 +02:00
David Tolnay
fa9057fa31
Merge pull request #949 from WiSaGaN/feature/support-system-time
...
Support std::time::SystemTime
2017-07-11 21:17:56 -07:00
Wangshan Lu
0084d82a50
Add tests for SystemTime
2017-07-12 12:01:40 +08:00
David Tolnay
9c679d9082
Test for serializing BTreeSet
2017-07-09 10:16:49 -07:00
David Tolnay
b0f9d2a0ba
Exclude macros file from being tested by itself
2017-07-09 09:24:29 -07:00