Merge pull request 963 from sfackler/u64-identifier

Conflicts:
    serde_derive/src/de.rs
This commit is contained in:
David Tolnay 2017-09-08 21:35:24 -07:00
commit 9ce107de25
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 5 additions and 2 deletions

View File

@ -1390,10 +1390,10 @@ fn deserialize_identifier(
"field"
};
let variant_indices = 0u32..;
let variant_indices = 0u64..;
let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len());
let visit_index = quote! {
fn visit_u32<__E>(self, __value: u32) -> _serde::export::Result<Self::Value, __E>
fn visit_u64<__E>(self, __value: u64) -> _serde::export::Result<Self::Value, __E>
where __E: _serde::de::Error
{
match __value {

View File

@ -23,7 +23,10 @@ fn test_variant_identifier() {
Bbb,
}
assert_de_tokens(&V::Aaa, &[Token::U8(0)]);
assert_de_tokens(&V::Aaa, &[Token::U16(0)]);
assert_de_tokens(&V::Aaa, &[Token::U32(0)]);
assert_de_tokens(&V::Aaa, &[Token::U64(0)]);
assert_de_tokens(&V::Aaa, &[Token::Str("Aaa")]);
assert_de_tokens(&V::Aaa, &[Token::Bytes(b"Aaa")]);
}