Erick Tryzelaar
97528b59cf
Add support for serializing newtype structs
...
This enables formats like JSON to serialize newtype wrapper
structs without the normal object wrapper. Consider types like:
```rust
struct Point {
x: u32,
y: u32,
}
stuct MyPoint(Point);
```
Before this patch, `MyPoint(1,2)` would get serialized as
`[{"x":1,"y":2}]`, but now it gets serialized as `{"x":1,"y"2}`.
2015-07-31 07:22:13 -07:00
Erick Tryzelaar
fefc010deb
Rename visit_enum_simple to visit_newtype_variant
2015-07-31 07:22:13 -07:00
Erick Tryzelaar
0348a3914d
Pass variant index to visit_enum_simple
2015-07-30 08:06:04 -07:00
Erick Tryzelaar
d2fef27721
Rename ser::Serializer::visit_enum_{unit,seq,map} to visit_{unit,tuple,struct}_variant
2015-07-30 06:45:21 -07:00
Erick Tryzelaar
0058e3a8d4
Merge pull request #111 from oli-obk/master
...
tuple enums with single element should not be a json-array
2015-07-29 13:35:43 -07:00
Oliver Schneider
24787195a1
serialize tuple enums with single element directly as the value instead of a sequence
2015-07-24 09:10:58 +02:00
Erick Tryzelaar
b1cb5379de
Add `#[serde(skip_serializing)] to skip serializing some fields
...
Closes #99
2015-07-23 08:07:49 -07:00
Erick Tryzelaar
b0512a4479
Fix deriving traits for fully generic types.
...
Closes #100
2015-07-23 07:25:27 -07:00
Erick Tryzelaar
affa9382be
Expose variant index to Serializer
2015-07-22 10:44:42 -07:00
Erick Tryzelaar
10f23dddfe
Rename named_* to use {enum,struct,unit}_*
...
This better reflects how they're used.
2015-07-22 10:44:42 -07:00
Erick Tryzelaar
236d40d73e
Add Serializer
hooks for sequence elements
2015-07-16 10:51:01 -04:00
Erick Tryzelaar
ed5b4d7319
Fix serializing generic enums
...
This fixes generic enums with variants that don't use all lifetime
and typarams. Closes #88 .
2015-06-18 08:45:03 -07:00
Erick Tryzelaar
ac3a3e922f
Fix compilation with rust nightly (613e57b44) and syntex 0.7.0
2015-06-08 06:55:36 -07:00
Erick Tryzelaar
2c24be90d2
Switch to using MultiDecorator
2015-05-18 22:49:49 -07:00
Erick Tryzelaar
24ac61f9f2
Pull codegen into it's own crate
2015-05-18 22:47:35 -07:00