Commit Graph

1655 Commits

Author SHA1 Message Date
David Tolnay
7e1b5c6ce4
Neater collect_str variable name for rustdoc 2017-03-05 16:26:05 -08:00
David Tolnay
36da8a5cee
Error message geared toward serializer users
The previous message was targeted toward Serializer implementors, which is not
the group that will be seeing this message most often.
2017-03-05 16:24:48 -08:00
David Tolnay
fbe85f399d
Force no_std formats to implement collect_str in the future 2017-03-05 16:22:02 -08:00
David Tolnay
880b27b19e
Identical signature for std and no_std collect_str 2017-03-05 16:17:03 -08:00
Anthony Ramine
a9a05350a9 Introduce Serializer::collect_str (fixes #786)
The default implementation collects the Display value into a String
and then passes that to Serializer::serialize_str when the std or collections
features are enabled, otherwise it unconditionally returns an error.
2017-02-28 12:11:47 +01:00
David Tolnay
abc081ce9c
Test rename_all attribute 2017-02-25 11:58:34 -08:00
David Tolnay
207940046b Merge pull request #788 from 46bit/issue-140
`rename_all` container attribute to have all children fit a naming convention
2017-02-25 11:38:33 -08:00
David Tolnay
47efbc6d75
Don't need to pass back the input here 2017-02-25 11:32:27 -08:00
David Tolnay
17279e8a4f
Simplify case conversion implementation 2017-02-25 11:32:22 -08:00
David Tolnay
06c631db05
Bring in the tests 2017-02-25 11:02:51 -08:00
David Tolnay
7952bad41f
Move case conversion to its own file 2017-02-25 11:02:25 -08:00
Michael Mokrysz
3308f81c3a Saving progress on naming convention conversion code to try new Inflector changes. #788 2017-02-25 13:24:49 +00:00
David Tolnay
75e6da02d3
Split up test suite so it compiles in parallel 2017-02-24 15:39:18 -08:00
David Tolnay
59ec931d8f
Release 0.9.9 2017-02-24 13:57:52 -08:00
David Tolnay
4b3c5ea99e
Fix clippy lint in content serializer 2017-02-24 13:56:44 -08:00
David Tolnay
d4ea4a7eef
Add test for enums containing enums
Fixes #775.
2017-02-24 13:50:47 -08:00
David Tolnay
5fbdadefb2
Deserializing enums in serde_test 2017-02-24 13:47:04 -08:00
David Tolnay
4da77e4200
Serialize to Content 2017-02-24 12:59:35 -08:00
David Tolnay
d797504407
Deserialize enums from &Content 2017-02-24 09:32:14 -08:00
Michael Mokrysz
84915268ee Minor fixes for pull request. Cheers @dtolnay. 2017-02-24 01:55:31 +00:00
Michael Mokrysz
3b59d47e07 Heavily refactored rename_all and switched to SCREAMING_SNAKE_CASE. 2017-02-23 23:22:54 +00:00
Michael Mokrysz
fc94c5399a Implementing rename_all container attribute using Inflector trait. #140 2017-02-23 18:58:41 +00:00
David Tolnay
8e5f472e27 Merge pull request #787 from 46bit/issue-775
Fix internally tagged enums by implementing ContentDeserializer::deserialize_enum
2017-02-22 18:23:18 -08:00
David Tolnay
5e7883945b
Fix clippy lint in Content::unexpected 2017-02-22 18:16:51 -08:00
David Tolnay
a4bd6b9a96
Fix content's SeqDeserializer on no_std 2017-02-22 18:14:56 -08:00
Michael Mokrysz
4c253748c2 Compiles and fixes internally tagged testcases. 2017-02-23 01:05:44 +00:00
Michael Mokrysz
8f6e1fb5b3 Resolved error typing. Needs to adapt to Content::Map with non-String keys.
`EnumDeserializer` is being adapted from:
  `serde_json::Value::Map<Vec<(String, Value)>>`
serde has a Map variant that allows non-String keys:
  `serde:🇩🇪:Content::Map<Vec<(Content, Content)>>`

There's a lot of assumptions in `EnumDeserializer` about `String` keys and I'm not sure what the adaptation should be.
2017-02-22 23:59:47 +00:00
Michael Mokrysz
4e665a71bd Attempt to port serde_json::Value::deserialize_enum for ContentDeserializer is being derailed by what error types should be used. 2017-02-22 22:55:18 +00:00
David Tolnay
017e6d304f
Release 0.9.8 2017-02-21 10:59:42 -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
c36743fa05 Merge pull request #782 from serde-rs/adjacent
Deserialization of Haskell style enums
2017-02-20 21:04:17 -08: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
Thomas de Zeeuw
7bee779514 Only allow #[serde(default)]` on structs 2017-02-21 00:15:00 +01: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
f98e7f6ba0 Merge pull request #778 from SimonSapin/serialize_display_bounded_length
Avoid some string allocations.
2017-02-20 11:09:32 -08:00
Simon Sapin
772b22b427 Avoid some string allocations. 2017-02-20 18:36:38 +01: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
David Tolnay
7dad6426da Merge pull request #774 from nox/limit-hints
Clamp hints coming from untrusted input to 4096
2017-02-19 13:51:21 -08:00
David Tolnay
792a5f7502
Also clamp the collection impls 2017-02-19 13:47:05 -08:00
Anthony Ramine
a4c738a9f3 Clamp hints coming from untrusted input to 4096 2017-02-19 14:29:41 +01:00
Elliott Slaughter
4538143d00 Initial work to support serialization of adjacently tagged enums. 2017-02-18 20:46:37 -08:00
David Tolnay
7f08894a32
Remove dependency on unneeded syn feature 2017-02-17 21:01:42 -08:00
David Tolnay
adf7b086b5
Remove outdated comment 2017-02-17 20:38:50 -08:00