Commit Graph

1716 Commits

Author SHA1 Message Date
David Tolnay
2f988aa5e6 Merge pull request #801 from jonhoo/ffi-strings
impls for null-terminated FFI string types
2017-03-05 13:51:09 -08:00
Jon Gjengset
d294a10e83
Only include ByteBuf when ser/de is on for std 2017-03-03 23:48:00 -05:00
Jon Gjengset
defcbef7ab
Use a non-stupid path for bytes::ByteBuf 2017-03-03 23:28:35 -05:00
Jon Gjengset
d90eecd4a2
Add tests for CStr(ing) ser/de 2017-03-03 18:06:04 -05:00
Jon Gjengset
0d6d077e6a
Serialize and deserialize CString through [u8] 2017-03-03 18:05:08 -05:00
Jon Gjengset
be09fc9bbb
Remove unsafe Deserialize impl for CStr
See also https://github.com/rust-lang/rust/issues/40248
2017-03-03 17:34:01 -05:00
Jon Gjengset
fc9d78e26b
Use serialize_bytes for speed 2017-03-03 17:14:39 -05:00
Jon Gjengset
9f83164c40
Don't serialize trailing NULL 2017-03-03 17:14:28 -05:00
Jon Gjengset
857974ab8a
impls for null-terminated FFI string types
Fixes #800.
2017-03-03 16:09:41 -05:00
David Tolnay
d70636f4d4 Merge pull request #794 from clarcharr/master
Documentation for serde_test.
2017-03-02 11:53:05 -08:00
Clar Charr
09e467cc4c Documentation for serde_test. 2017-02-28 18:20:27 -05:00
David Tolnay
51ed9c2a40
Release 0.9.10 2017-02-28 12:45:39 -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
fe9ea3b4b4
Fix needless_pass_by_value lint 2017-02-27 19:43:42 -08:00
David Tolnay
f944b453c4 Merge pull request #792 from elliottslaughter/fix_serialize_tuple_docs
Fix documentation of serialize_tuple and SerializeTuple
2017-02-27 14:05:15 -08:00
Elliott Slaughter
a993630cf9 Fix documentation of serialize_tuple and SerializeTuple. 2017-02-27 14:00:21 -08: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