Merge pull request #1888 from joshtriplett/fix-enum-deserialization-u64
Fix hand-written enum variant deserializations to allow u64 discriminant
This commit is contained in:
commit
a5490e20e1
@ -1313,7 +1313,7 @@ macro_rules! variant_identifier {
|
|||||||
formatter.write_str($expecting_message)
|
formatter.write_str($expecting_message)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_u32<E>(self, value: u32) -> Result<Self::Value, E>
|
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
E: Error,
|
E: Error,
|
||||||
{
|
{
|
||||||
@ -1321,7 +1321,7 @@ macro_rules! variant_identifier {
|
|||||||
$(
|
$(
|
||||||
$index => Ok($name_kind :: $variant),
|
$index => Ok($name_kind :: $variant),
|
||||||
)*
|
)*
|
||||||
_ => Err(Error::invalid_value(Unexpected::Unsigned(value as u64), &self),),
|
_ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self),),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2326,7 +2326,7 @@ where
|
|||||||
formatter.write_str("`Unbounded`, `Included` or `Excluded`")
|
formatter.write_str("`Unbounded`, `Included` or `Excluded`")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_u32<E>(self, value: u32) -> Result<Self::Value, E>
|
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
E: Error,
|
E: Error,
|
||||||
{
|
{
|
||||||
@ -2335,7 +2335,7 @@ where
|
|||||||
1 => Ok(Field::Included),
|
1 => Ok(Field::Included),
|
||||||
2 => Ok(Field::Excluded),
|
2 => Ok(Field::Excluded),
|
||||||
_ => Err(Error::invalid_value(
|
_ => Err(Error::invalid_value(
|
||||||
Unexpected::Unsigned(value as u64),
|
Unexpected::Unsigned(value),
|
||||||
&self,
|
&self,
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
@ -2492,7 +2492,7 @@ where
|
|||||||
formatter.write_str("`Ok` or `Err`")
|
formatter.write_str("`Ok` or `Err`")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_u32<E>(self, value: u32) -> Result<Self::Value, E>
|
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
E: Error,
|
E: Error,
|
||||||
{
|
{
|
||||||
@ -2500,7 +2500,7 @@ where
|
|||||||
0 => Ok(Field::Ok),
|
0 => Ok(Field::Ok),
|
||||||
1 => Ok(Field::Err),
|
1 => Ok(Field::Err),
|
||||||
_ => Err(Error::invalid_value(
|
_ => Err(Error::invalid_value(
|
||||||
Unexpected::Unsigned(value as u64),
|
Unexpected::Unsigned(value),
|
||||||
&self,
|
&self,
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user