Commit Graph

622 Commits

Author SHA1 Message Date
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
Jon Gjengset
d90eecd4a2
Add tests for CStr(ing) ser/de 2017-03-03 18:06:04 -05:00
David Tolnay
abc081ce9c
Test rename_all attribute 2017-02-25 11:58:34 -08:00
David Tolnay
75e6da02d3
Split up test suite so it compiles in parallel 2017-02-24 15:39:18 -08:00
David Tolnay
d4ea4a7eef
Add test for enums containing enums
Fixes #775.
2017-02-24 13:50:47 -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
3d6e086d3e
Support custom paths in container attribute serde(default="...") 2017-02-20 17:06:00 -08:00
Thomas de Zeeuw
7bee779514 Only allow #[serde(default)]` on structs 2017-02-21 00:15:00 +01: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
a3fe03c323
Serialization of Haskell style enums 2017-02-19 16:04:39 -08:00
Elliott Slaughter
4538143d00 Initial work to support serialization of adjacently tagged enums. 2017-02-18 20:46:37 -08:00
David Tolnay
c590df13b9
Add compile-fail test for the with attribute 2017-02-16 18:43:04 -08:00
David Tolnay
f500db6e91
Pair serialize_with and deserialize_with into one attribute 2017-02-14 17:36:50 -08:00
David Tolnay
45a36f1219
Fix proc macro panic message in tests 2017-02-08 08:12:32 -08:00
David Tolnay
02e6c04e9f
Check for sequence end 2017-02-02 22:13:32 -08:00
David Tolnay
ff21d557c7
Untagged and internally tagged enums 2017-02-02 18:48:30 -08:00
David Tolnay
b7ca574bb3
Use absolute paths to Ok and Err 2017-02-01 09:42:12 -08:00
David Tolnay
39c7797633
Allow running travis build locally 2017-01-31 12:07:31 -08:00
Oliver Schneider
368784949e move to cargo clippy instead of using the clippy plugin (#733)
* move to cargo clippy instead of using the clippy plugin

fixes #729

* non-exectable scripts must be run with `sh`

* don't build serde in the clippy travis job

* only run clippy tests if installing clippy succeeds

* why is travis so picky?

* no more serde_codegen

* serde_test_suite_deps has no features

* don't use empty loops, llvm optimizes them to undefined behaviour

* abort the clippy job when clippy lints are triggered

* use caches on travis to speed up builds

* why are we even using `travis-cargo`?

* need to reinstall clippy frequently due to nightly updates

* command line tools are hard
2017-01-31 09:09:37 -08:00
David Tolnay
a9b5cc4830
Fix invalid_length message for tuples and arrays 2017-01-28 15:00:54 -08:00
David Tolnay
dd13fd3a34
Isolate the compiletest dependencies 2017-01-27 14:53:30 -08:00
David Tolnay
91f628727b
Clean up the compile_tests script 2017-01-27 14:37:28 -08:00
David Tolnay
09c69da909
Move test macro to where it is used 2017-01-25 20:55:55 -08:00
David Tolnay
7ee175f448
Remove duplicate btreemap macro 2017-01-25 20:54:31 -08:00
David Tolnay
8fb554e593
Rename no_std tests to underscores 2017-01-25 20:50:23 -08:00
David Tolnay
7a2bfdc1dd
Consistent underscores in root directory 2017-01-25 20:45:33 -08:00