Commit Graph

271 Commits

Author SHA1 Message Date
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