mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 23:11:01 +00:00
Make Value use the 'json' format string
This commit is contained in:
+2
-2
@@ -574,7 +574,7 @@ impl ser::Serializer for Serializer {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn format() -> &'static str {
|
fn format() -> &'static str {
|
||||||
"value"
|
"json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,7 +685,7 @@ impl de::Deserializer for Deserializer {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn format() -> &'static str {
|
fn format() -> &'static str {
|
||||||
"value"
|
"json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1047,7 +1047,7 @@ fn test_missing_renamed_field() {
|
|||||||
fn test_missing_fmt_renamed_field() {
|
fn test_missing_fmt_renamed_field() {
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
struct Foo {
|
struct Foo {
|
||||||
#[serde(rename(json="y", value="z"))]
|
#[serde(rename(json="y"))]
|
||||||
x: Option<u32>,
|
x: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1061,7 +1061,7 @@ fn test_missing_fmt_renamed_field() {
|
|||||||
assert_eq!(value, Foo { x: None });
|
assert_eq!(value, Foo { x: None });
|
||||||
|
|
||||||
let value : Foo = from_value(Value::Object(treemap!(
|
let value : Foo = from_value(Value::Object(treemap!(
|
||||||
"z".to_string() => Value::I64(5)
|
"y".to_string() => Value::I64(5)
|
||||||
))).unwrap();
|
))).unwrap();
|
||||||
assert_eq!(value, Foo { x: Some(5) });
|
assert_eq!(value, Foo { x: Some(5) });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user