Commit Graph

32 Commits

Author SHA1 Message Date
Konrad Borowski
c3b9ee314b Use try_borrow for serializing RefCell 2018-06-01 09:09:40 +02:00
David Tolnay
9083cf4b00
Test integer128 impls 2018-05-20 22:17:35 -07:00
David Tolnay
a58abae193
Test Weak serialize impls 2018-05-07 11:23:17 -07:00
David Tolnay
d82d1707d6
Format with rustfmt 0.6.0 2018-04-30 01:42:46 -07:00
David Tolnay
ed6a1de311
Auto format attributes on their own line 2017-12-23 20:24:57 -08:00
Markus Westerlind
aad7a7987f Add an example to the Configure trait 2017-11-06 10:35:22 +01:00
David Tolnay
9b08915a18
Add tests for std::num::Wrapping impls 2017-10-31 09:32:58 -07:00
David Tolnay
9be3d32016
Remove redundant readable/compact tests
This functionality is covered well enough by the std::net types.
2017-10-17 23:16:21 -07:00
David Tolnay
4ed0362c8e
Panic by default in serde_test is_human_readable
The serde_test Serializer and Deserializer panic in is_human_readable unless the
readableness has been set explicitly through one of the hidden functions. This
is to force types that have distinct readable/compact representations to be
tested explicitly in one or the other, rather than with a plain assert_tokens
which arbitrarily picks one.

We need to follow up by designing a better API in serde_test to expose this
publicly. For now serde_test cannot be used to test types that rely on
is_human_readable. (The hidden functions are meant for our test suite only.)
2017-10-17 09:49:42 -07:00
Markus Westerlind
85c05d301a Fix the non-readble IpAddr serialize implementations 2017-09-11 17:40:02 +02:00
Markus Westerlind
ad3335e5d6 Serialize non-human-readble ip addresses as tuples
Since we know exactly how many bytes we should serialize as we can hint
to the serializer that it is not required which further reduces the
serialized size when compared to just serializing as bytes.
2017-09-11 15:54:53 +02:00
Markus Westerlind
0dccbb1f11 Serialize to binary if the serde format is not human readable
This implements the KISS suggested in https://github.com/serde-rs/serde/issues/790.
It is possible that one of the other approaches may be better but this
seemed like the simplest one to reignite som discussion.

Personally I find the original suggestion of adding two traits perhaps slightly
cleaner in theory but I think it ends up more complicated in the end
since the added traits also need to be duplicated to to the `Seed`
traits.

Closes #790
2017-09-07 16:20:57 +02:00
David Tolnay
e4ea2a56e9
Serialize unsized Arc and Rc 2017-09-04 10:31:03 -07:00
Markus Westerlind
85bccf42b6 Fix SystemTime serialization test on Windows
Windows's `SystemTime` do not have nanosecond resolution which caused the test duration to be truncated b1363a73ed/src/libstd/sys/windows/time.rs (L177)
2017-07-16 12:16:07 +02:00
David Tolnay
fa9057fa31 Merge pull request #949 from WiSaGaN/feature/support-system-time
Support std::time::SystemTime
2017-07-11 21:17:56 -07:00
Wangshan Lu
0084d82a50 Add tests for SystemTime 2017-07-12 12:01:40 +08:00
David Tolnay
9c679d9082
Test for serializing BTreeSet 2017-07-09 10:16:49 -07:00
David Tolnay
15341780a2
Use struct variants in test suite 2017-04-19 13:06:31 -07:00
David Tolnay
26a6ba177c
Remove error from serde_test public API 2017-04-19 11:54:48 -07:00
David Tolnay
86deb8db79
Remove seq_fixed_size in favor of tuple 2017-04-17 12:07:49 -07:00
David Tolnay
3f920f645c
License boilerplate 2017-04-13 17:34:42 -07:00
David Tolnay
ea8fb97beb
Format in rfc style 2017-04-13 12:32:29 -07:00
David Tolnay
e133b8b708
Fix unused import on windows 2017-04-09 14:11:27 -07:00
David Tolnay
51d3fb1ebc
Update token names in test suite 2017-04-05 10:40:14 -07:00
David Tolnay
67ed7a0edd
Eliminate Sep tokens in serde_test 2017-04-05 09:42:27 -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
Robert O'Callahan
aebe1fddab Add Serialize impl for std::ops::Range 2017-03-10 00:35:04 +13:00
David Tolnay
dd6989d551
Actually run unstable tests 2017-03-08 21:02:15 -08:00
Jon Gjengset
d90eecd4a2
Add tests for CStr(ing) ser/de 2017-03-03 18:06:04 -05:00
David Tolnay
75e6da02d3
Split up test suite so it compiles in parallel 2017-02-24 15:39:18 -08:00
David Tolnay
09c69da909
Move test macro to where it is used 2017-01-25 20:55:55 -08:00
David Tolnay
7a2bfdc1dd
Consistent underscores in root directory 2017-01-25 20:45:33 -08:00