Skip to content

Commit

Permalink
Update the OneOrMany doctest to test serialization too #728
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbb committed Apr 17, 2024
1 parent 57e4ee2 commit f12ece2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions serde_with/src/lib.rs
Expand Up @@ -1662,9 +1662,9 @@ pub struct Bytes;
/// # #[derive(Debug, PartialEq)]
/// #[derive(Deserialize, serde::Serialize)]
/// struct Data {
/// #[serde_as(deserialize_as = "OneOrMany<_, PreferOne>")]
/// #[serde_as(as = "OneOrMany<_, PreferOne>")]
/// countries: Vec<String>,
/// #[serde_as(deserialize_as = "OneOrMany<_, PreferMany>")]
/// #[serde_as(as = "OneOrMany<_, PreferMany>")]
/// cities: Vec<String>,
/// }
///
Expand Down Expand Up @@ -1693,7 +1693,7 @@ pub struct Bytes;
/// "countries": "Spain",
/// "cities": ["Berlin"],
/// });
/// assert_eq!(data, serde_json::from_value(j).unwrap());
/// assert_eq!(serde_json::to_value(data).unwrap(), j);
/// # }
/// ```
#[cfg(feature = "alloc")]
Expand Down

0 comments on commit f12ece2

Please sign in to comment.