Commit Graph

188 Commits

Author SHA1 Message Date
David Tolnay
726eea9a97
Separate out the private functionality
This makes it easier when clicking through [src] links from rustdoc, not having
to sift through public and internal code combined together.
2017-04-07 09:46:48 -07:00
David Tolnay
dd62801b22
Use spaces around =-sign like Rust does 2017-04-06 14:22:03 -07:00
David Tolnay
732b91e53d
Make the built-in visitors private 2017-04-04 18:59:57 -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
David Tolnay
08e2182042
UFCS for Option::map and Result::map 2017-03-18 13:31:03 -07:00
David Tolnay
8c7396c35a
Be consistent with UFCS and double underscores 2017-03-18 10:33:22 -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
David Tolnay
9a3c1243f4
Deserialization of Haskell style enums 2017-02-20 20:05:06 -08:00
David Tolnay
599a1b6607
Fragments that keep track of type of syntax
Fixes #777.
2017-02-20 17:12:35 -08:00
David Tolnay
3d6e086d3e
Support custom paths in container attribute serde(default="...") 2017-02-20 17:06:00 -08:00
David Tolnay
ad480d2b04 Merge pull request #780 from Thomasdezeeuw/default_container
Add support for `#[serde(default)]` on structs
2017-02-20 16:10:28 -08:00
David Tolnay
dff919a926
Rename __simple_value to __field0 to be consistent with tuples 2017-02-20 14:16:54 -08:00
David Tolnay
bac593573c
Drop aster dependency 2017-02-20 13:50:17 -08: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
3bf8cda994
Update generics handling to use split_for_impl 2017-02-20 13:04:40 -08:00
David Tolnay
535ab1e04b
Merge pull request #771 from elliottslaughter:internally_content_tagged 2017-02-19 16:08:49 -08: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
adf7b086b5
Remove outdated comment 2017-02-17 20:38:50 -08:00
David Tolnay
e8651a52e7
Rustfmt 2017-02-12 22:15:59 -08:00
Oliver Schneider
393b19ee8a update codegen to the content changes 2017-02-04 10:37:50 +01:00
David Tolnay
ff21d557c7
Untagged and internally tagged enums 2017-02-02 18:48:30 -08:00
David Tolnay
a55d812441
Even more absolute paths 2017-02-01 12:12:39 -08:00
David Tolnay
b7ca574bb3
Use absolute paths to Ok and Err 2017-02-01 09:42:12 -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
c52e131a03
Replace deprecated MacroInput 2017-01-27 15:42:43 -08:00
David Tolnay
e0d6b9d010
Merge serde_codegen into serde_derive crate 2017-01-25 20:07:55 -08:00
David Tolnay
894a21bc1f
Remove the proc_macro feature gate 2017-01-08 00:11:11 -08:00
David Tolnay
36f07912b8
Remove no-longer-necessary cfg
This was fixed in Rust, allowing proc macro crates to be tested.
2016-12-17 17:32:11 -08:00
David Tolnay
a16f07858b Ask proc_macro_derive to ignore serde attributes 2016-11-15 21:29:34 -05:00
David Tolnay
a9b6cbb8b3
Use post-expansion crate to let other custom derives see serde attrs 2016-10-18 09:00:33 -07:00
Mark Roghelia
ef5d09e144 Rename rustc_macro to proc_macro
Fixes #575
2016-10-08 18:29:36 -04:00
David Tolnay
0c18c151e2
Revamp serde_codegen_internals error handling 2016-09-27 00:11:37 -07:00
David Tolnay
c34baa1e5f
No more syntex for serde_derive 2016-09-11 19:55:13 -07:00
David Tolnay
88d845c4d1
Include! test suite for serde_derive 2016-09-01 21:28:40 -07:00
David Tolnay
3c45e5c7a5
Next iteration 2016-08-30 23:55:08 -07:00
David Tolnay
d914fdf67b
Macros 1.1 2016-08-28 22:21:25 -07:00