Commit Graph

2351 Commits

Author SHA1 Message Date
David Tolnay
8eb50186e0 Merge pull request #831 from serde-rs/derivepath
Use the live serde_derive for serde doc tests
2017-03-30 22:55:33 -07:00
David Tolnay
4dec5f4de8
Update example code for zero copy 2017-03-30 22:54:42 -07:00
David Tolnay
8e0c036158
Merge branch 'derivepath' into 'lifetime' 2017-03-30 22:48:48 -07:00
David Tolnay
7d985ff3fd
Use the live serde_derive for serde doc tests
This is required as both are updated to Deserialize<'de> together.
2017-03-30 22:45:15 -07:00
David Tolnay
d3a2f5e268
Add a 'de lifetime to the deserialize traits 2017-03-29 00:10:34 -07:00
David Tolnay
59b3961ad4
Release 0.9.12 2017-03-27 15:45:14 -07:00
David Tolnay
dbc9a60c5f Merge pull request #824 from alexcrichton/osstr-osstring
Implement Serialize/Deserialize for OsStr/OsString
2017-03-27 15:39:07 -07:00
Alex Crichton
ce687431f3 Implement Serialize/Deserialize for OsStr/OsString
This commit implements the two serde traits for the libstd `OsStr` and
`OsString` types. This came up as a use case during implementing sccache where
we're basically just doing IPC to communicate paths around. Additionally the
`Path` and `PathBuf` implementations have been updated to delegate to the os
string ones.

These types are platform-specific, however, so the serialization/deserialization
isn't trivial. Currently this "fakes" a newtype variant for Unix/Windows to
prevent cross-platform serialization/deserialization. This means if you're doing
IPC within the same OS (e.g. Windows to Windows) then serialization should be
infallible. If you're doing IPC across platforms (e.g.  Unix to Windows) then
using `OsString` is guaranteed to fail as bytes from one OS won't deserialize on
the other (even if they're unicode).
2017-03-27 11:44:50 -07:00
David Tolnay
71ccc5753b Merge pull request #820 from serde-rs/reexport
Re-export derives from serde
2017-03-26 20:37:12 -07:00
David Tolnay
13886435a6
Re-export derives from serde 2017-03-21 16:54:31 -07:00
David Tolnay
08e2182042
UFCS for Option::map and Result::map 2017-03-18 13:31:03 -07:00
David Tolnay
d60595cc27
Use format_args! to simplify de::Error 2017-03-18 10:48:47 -07:00
David Tolnay
8c7396c35a
Be consistent with UFCS and double underscores 2017-03-18 10:33:22 -07:00
David Tolnay
42b2fd8eec
Improve error message parsing from and into 2017-03-18 09:22:44 -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
c488cec641
Remove RangeInclusive impl for now
The old impl is inconsistent with the new ops::Range impl.
2017-03-13 11:09:56 -07:00
David Tolnay
fcc3c69a49
Range impl is defined when building with std 2017-03-09 12:04:02 -08:00
David Tolnay
350c2e835b
Remove duplicate ops::Range serialize impl 2017-03-09 11:57:36 -08:00
David Tolnay
a0a031677e Merge pull request #813 from rocallahan/support-range
Implement `Serialize`/`Deserialize` for `Range`
2017-03-09 11:55:21 -08:00
Robert O'Callahan
cc0d045f5c Add Deserialize impl for std::ops::Range
Resolves #796
2017-03-10 08:39:34 +13:00
Robert O'Callahan
aebe1fddab Add Serialize impl for std::ops::Range 2017-03-10 00:35:04 +13:00
David Tolnay
77ee306b57
Format serde with rustfmt 0.8.0 2017-03-08 21:11:17 -08:00
David Tolnay
6750fdaae1 Merge pull request #811 from jonhoo/deserialize-cstr
Add Deserialize impl for CStr
2017-03-08 21:06:09 -08:00
David Tolnay
dd6989d551
Actually run unstable tests 2017-03-08 21:02:15 -08:00
Jon Gjengset
0c2fed49e2
Add Deserialize impl for CStr
Fixes #810
2017-03-08 23:57:26 -05:00
Oliver Schneider
a4ee9bd045 Merge pull request #808 from serde-rs/u32
Implement deserialize_enum for U32Deserializer
2017-03-07 18:58:29 +01:00
David Tolnay
6d9397d573
Implement deserialize_enum for U32Deserializer 2017-03-07 09:05:33 -08:00
David Tolnay
dc9445f873
Release 0.9.11 2017-03-05 16:51:44 -08:00
David Tolnay
17bc40ec1c Merge pull request #789 from nox/display
Introduce Serializer::collect_str (fixes #786)
2017-03-05 16:47:22 -08:00
David Tolnay
2184fef82f
Add format_args example to collect_str 2017-03-05 16:43:31 -08:00
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
David Tolnay
cc06f070d1
Use the existing CString error message 2017-03-05 13:59:18 -08:00
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