676 Commits

Author SHA1 Message Date
David Tolnay
0d4d47c398
Release 1.0.29 2018-03-09 00:24:08 -08:00
David Tolnay
3f75239bfb
Release 1.0.28 2018-03-08 11:39:32 -08:00
David Tolnay
d6f07f2f47
Ignore redundant_field_names lint 2018-02-27 11:13:26 -08:00
David Tolnay
8bba8447ef
Whitelist some new clippy lints 2018-02-05 10:27:04 -08:00
David Tolnay
a185df1e77
Ignore decimal_literal_representation lint
The number 4096 is used to cap the size of collections that we preallocate.

    cmp::min(hint.unwrap_or(0), 4096)

I find this number more understandable than 0x1000.
2018-01-26 00:19:26 -08:00
David Tolnay
59017aa19b
Follow clippy's replace_consts lint 2018-01-15 17:40:32 -08:00
Martin Lindhe
ae0373643c fix some typos 2018-01-03 15:16:45 +01:00
David Tolnay
7aeabddd2f
Release 1.0.27 2017-12-30 22:19:41 -05:00
David Tolnay
9cfcd78c87
Release 1.0.26 2017-12-27 17:33:32 -05:00
David Tolnay
4751627f1c
Implement De/Serialize for PhantomData where T: ?Sized 2017-12-27 17:32:49 -05:00
David Tolnay
ae59c6b6d2
Release 1.0.25 2017-12-23 23:33:59 -05:00
David Tolnay
ed6a1de311
Auto format attributes on their own line 2017-12-23 20:24:57 -08:00
David Tolnay
ee75e6c0e9
Format with rustfmt-nightly 0.3.4 2017-12-23 20:17:52 -08:00
David Tolnay
56d5d7f761
Rename deserialize_from to deserialize_in_place 2017-12-17 10:46:44 -08:00
David Tolnay
0c2e91f28a
Merge branch serde-rs/master into Gankro/deserialize_from 2017-12-11 20:49:23 -08:00
David Tolnay
3700779bfa
More meaningful names and types for nop_reserve 2017-12-10 23:18:08 -08:00
David Tolnay
9641978481
Hide deserialize_from 2017-12-10 21:55:07 -08:00
David Tolnay
ffd2017c6f
Use the default deserialize_from for Option<T>
The custom one was functionally identical to the default implementation given by
the Deserialize trait. If someone has benchmarks that the custom one performs
better, we can put it back.
2017-12-10 21:27:44 -08:00
David Tolnay
b7eb42aa6b
Release 1.0.24 2017-12-09 14:43:55 -08:00
Alexis Beingessner
bc221abb04 Augment builtin std/core Deserialize impls to implement deserialize_from 2017-12-04 13:23:26 -05:00
Alexis Beingessner
ab5e8780ab Add deserialize_from to Deserialize 2017-12-04 13:23:26 -05:00
Kyle Huey
4a0c4e0c25 Mark size_hint::cautious as inline. 2017-12-01 14:31:52 -08:00
David Tolnay
8c34e0940f
Release 1.0.23 2017-11-29 22:26:32 -08:00
David Tolnay
797d049db5
Release 1.0.22 2017-11-29 20:01:43 -08:00
David Tolnay
f218f4d7bf
Release 1.0.21 2017-11-15 22:24:18 -08:00
Alex Shapiro
8c0a2015be
Fix error when deserializing untagged enum
Serde's `ContentDeserializer` and `ContentRefDeserializer`
cannot deserialize struct enum variant associated data when
that data is encoded as a sequence. This failure leads to
errors when decoding an enum nested in another untagged
enum. For example:

    #[derive(Serialize, Deserialize)]
    #[serde(untagged)]
    enum Foo {
        A(Bar),
    }

    #[derive(Serialize, Deserialize)]
    enum Bar {
        B{f1: String},
    }

    let data1 = Foo::A(Bar::B{f1: "Hello".into()});
    let bytes = rmp_serde::to_vec(&data1).unwrap();
    let data2 = rmp_serde::from_slice::<Foo>(&bytes).unwrap();

Deserializing fails with the error `Syntax("data did not
match any variant of untagged enum Foo")`, but the
underlying failure occurs when decoding the associated data
of `Bar::B`.

This pull request fixes the issue by allowing
`ContentDeserializer` and `ContentRefDeserializer` to
deserialize sequence-encoded struct enum variant data.
2017-11-15 21:56:33 -08:00
David Tolnay
4773863e3a
Release 1.0.20 2017-11-12 10:29:08 -08:00
David Tolnay
88d5fe6bfd
Release 1.0.19 2017-11-06 23:50:24 -08:00
David Tolnay
9e7a3437d9
Allow internally tagged newtype variant containing unit struct 2017-11-06 23:32:36 -08:00
David Tolnay
d537f1e1f0
Whitelist needless_pass_by_value lint
This lint has a false positive on trait methods with a default implementation.
2017-11-06 22:10:11 -08:00
David Tolnay
ab68132b1f
Release 1.0.18 2017-11-03 10:20:41 -07:00
David Tolnay
2b1303f59c
Whitelist const_static_lifetime
This clippy suggestion is not stable in the older rustc we support.
2017-10-31 22:23:39 -07:00
David Tolnay
ad680cbd44
Release 1.0.17 2017-10-31 09:36:06 -07:00
David Tolnay
ff0cfb1f1f
Clean up trailing whitespace and where-clauses 2017-10-31 09:36:05 -07:00
David Tolnay
501aa3ee1d
Share the import of std::num::Wrapping 2017-10-31 09:27:58 -07:00
Zoe Juozapaitis
a7e4911ddb Add newlines to ends of files 2017-10-31 04:29:00 -07:00
Zoe Juozapaitis
eb08f037f5 Add std::num::Wrapping support 2017-10-31 03:02:58 -07:00
David Tolnay
ab7c003b64
Remove associated constants workaround
This has been stable since Rust 1.20.
2017-10-22 11:55:16 -07:00
David Tolnay
422191fcb0
Release 1.0.16 2017-10-22 11:29:44 -07:00
David Tolnay
4ba748c902
Clean up trailing whitespace 2017-10-22 11:29:35 -07:00
David Tolnay
14ed6f2dab
Simplify some IntoDeserializer deserializer types 2017-10-20 21:38:18 -07:00
David Tolnay
30606a43aa
IntoDeserializer for HashSet and HashMap with non-default hasher 2017-10-20 21:36:40 -07:00
David Tolnay
57873cce28
Remove unused deserialization macros on no_std 2017-10-17 10:04:26 -07:00
David Tolnay
4cecaf8d02
Test the maximum std::net string lengths 2017-10-15 20:32:30 -07:00
David Tolnay
50c696aabe
Write is_human_readable examples 2017-10-15 20:27:03 -07:00
David Tolnay
2f58a20bc6
Inline is_human_readable 2017-10-15 16:54:48 -07:00
David Tolnay
030459a040 Merge pull request #1044 from Marwes/human_readable
Serialize to binary if the serde format is not human readable
2017-10-15 16:39:58 -07:00
David Tolnay
ea1a729088
Release 1.0.15 2017-09-17 13:58:35 -07:00
David Tolnay
b98a9a8f9b
Support deserializing internally tagged enum from seq
During serialization, internally tagged enums invoke the Serializer's
serialize_struct. In JSON this turns into a map which uses visit_map
when deserialized. But some formats employ visit_seq when
deserializing a struct. One example is rmp-serde. Such formats were
previously unable to deserialize an internally tagged enum. This
change fixes it by adding visit_seq for internally tagged enums.
2017-09-17 13:45:12 -07:00
Markus Westerlind
3b135431fd Try to fix compilation on 1.13 2017-09-14 17:12:23 +02:00