Commit Graph

76 Commits

Author SHA1 Message Date
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
spikefoo
1669c69714 Add a combined #serde[(skip)] field attribute 2017-05-16 12:33:26 +03:00
David Tolnay
cda1fc46b0
Fix internally tagged struct variant containing unit variant containing borrowed string 2017-05-14 12:39:42 -07:00
David Tolnay
c1259fbc87
Support borrowing within internally tagged enum 2017-05-10 19:56:05 -07:00
Paul Collier
f347b2d363 impl Deserialize for &'a Path 2017-05-10 13:03:03 -04: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
2d465415c5
Take credit 2017-04-20 08:13:46 -07:00
David Tolnay
15341780a2
Use struct variants in test suite 2017-04-19 13:06:31 -07:00
David Tolnay
26a6ba177c
Remove error from serde_test public API 2017-04-19 11:54:48 -07:00
David Tolnay
86deb8db79
Remove seq_fixed_size in favor of tuple 2017-04-17 12:07:49 -07:00
David Tolnay
cdfd445528
Generate deserialize impls for identifiers 2017-04-14 21:53:48 -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
0d82bbf74f
Rename ValueDeserializer trait to IntoDeserializer 2017-04-11 23:20:35 -07:00
David Tolnay
517270a943 Merge pull request #858 from serde-rs/remote
Derive for remote types
2017-04-10 12:33:38 -07:00
David Tolnay
6a6606cd64
Test unknown field in remote struct 2017-04-10 12:23:02 -07:00
David Tolnay
174867295b
Test missing field in remote struct 2017-04-10 12:22:51 -07:00
David Tolnay
ad5bf04c4e
Test for incorrect remote type deserializing 2017-04-10 12:15:40 -07:00
David Tolnay
2deacf8eaa
Detect incorrect remote type without getter 2017-04-10 12:12:00 -07:00
David Tolnay
e133b8b708
Fix unused import on windows 2017-04-09 14:11:27 -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
5ec317a899
More compile-fail tests for remote derive 2017-04-09 11:11:27 -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
995f2b3f76
Ignore clippy false positive 2017-04-07 09:21:30 -07:00
David Tolnay
6388019ad4
Relax impls for [T; 0] 2017-04-05 17:34:13 -07:00
David Tolnay
aa30ef827c
Move Bytes and ByteBuf to their own crate
Moved to https://github.com/serde-rs/bytes.
2017-04-05 15:21:27 -07:00
David Tolnay
e66033e53e
Remove implicit conversion from float to integer 2017-04-05 11:25:12 -07:00
David Tolnay
51d3fb1ebc
Update token names in test suite 2017-04-05 10:40:14 -07:00
David Tolnay
67ed7a0edd
Eliminate Sep tokens in serde_test 2017-04-05 09:42:27 -07:00
David Tolnay
c3d9b42cdf
Fix handling of option and newtype in IgnoredAny 2017-04-05 09:19:22 -07:00
David Tolnay
cabc299447 Merge pull request #839 from serde-rs/conv
Remove questionable type conversions
2017-04-05 08:11:50 -07:00
David Tolnay
b43554fbb1
Require slice of tokens in serde_test::Deserializer 2017-04-05 00:22:00 -07:00
David Tolnay
5871fb9ce0
Remove lifetime from serde_test::Token 2017-04-05 00:17:50 -07:00
David Tolnay
d03ecda333
Test that conversions do not happen 2017-04-04 18:50:40 -07:00
David Tolnay
7a722d5060
Remove questionable conversion tests 2017-04-04 18:38:58 -07:00
David Tolnay
20ff9ba89b
Add tests of deserializing borrows 2017-04-04 10:47:21 -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
Alex Crichton
ce687431f3 Implement Serialize/Deserialize for OsStr/OsString
This commit implements the two serde traits for the libstd `OsStr` and
`OsString` types. This came up as a use case during implementing sccache where
we're basically just doing IPC to communicate paths around. Additionally the
`Path` and `PathBuf` implementations have been updated to delegate to the os
string ones.

These types are platform-specific, however, so the serialization/deserialization
isn't trivial. Currently this "fakes" a newtype variant for Unix/Windows to
prevent cross-platform serialization/deserialization. This means if you're doing
IPC within the same OS (e.g. Windows to Windows) then serialization should be
infallible. If you're doing IPC across platforms (e.g.  Unix to Windows) then
using `OsString` is guaranteed to fail as bytes from one OS won't deserialize on
the other (even if they're unicode).
2017-03-27 11:44:50 -07:00
David Tolnay
42b2fd8eec
Improve error message parsing from and into 2017-03-18 09:22:44 -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
Robert O'Callahan
cc0d045f5c Add Deserialize impl for std::ops::Range
Resolves #796
2017-03-10 08:39:34 +13:00
Robert O'Callahan
aebe1fddab Add Serialize impl for std::ops::Range 2017-03-10 00:35:04 +13:00
David Tolnay
dd6989d551
Actually run unstable tests 2017-03-08 21:02:15 -08:00
Jon Gjengset
0c2fed49e2
Add Deserialize impl for CStr
Fixes #810
2017-03-08 23:57:26 -05:00
David Tolnay
6d9397d573
Implement deserialize_enum for U32Deserializer 2017-03-07 09:05:33 -08:00
David Tolnay
cc06f070d1
Use the existing CString error message 2017-03-05 13:59:18 -08:00