Skip to content

Commit

Permalink
Merge #547
Browse files Browse the repository at this point in the history
547: Document why `double_option` cannot be used in `serde_as` r=jonasbb a=jonasbb

And remove an outdated version check.

bors r+

Co-authored-by: Jonas Bushart <jonas@bushart.org>
  • Loading branch information
bors[bot] and jonasbb authored Feb 13, 2023
2 parents b244acf + 9206c4f commit a079e9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 13 additions & 0 deletions serde_with/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ use crate::prelude::*;
/// * `Some(None)`: Represents a `null` value.
/// * `Some(Some(value))`: Represents an existing value.
///
/// Note: This cannot be made compatible to `serde_as`, since skipping of values is only available on the field level.
/// A hypothetical `DoubleOption<T>` with a `SerializeAs` implementation would allow writing something like this.
/// This cannot work, since there is no way to tell the `Vec` to skip the inner `DoubleOption` if it is `None`.
///
/// ```rust
/// # #[cfg(FALSE)] {
/// # struct Foobar {
/// #[serde_as(as = "Vec<DoubleOption<_>>")]
/// data: Vec<Option<Option<i32>>>,
/// # }
/// # }
/// ```
///
/// # Examples
///
/// ```rust
Expand Down
2 changes: 0 additions & 2 deletions serde_with_macros/tests/compiler-messages.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// This test fails for older compiler versions since the error messages are different.
#[rustversion::attr(before(1.54), ignore)]
#[cfg_attr(tarpaulin, ignore)]
// The error messages are different on beta and nightly, thus breaking the test.
#[rustversion::attr(beta, ignore)]
Expand Down

0 comments on commit a079e9c

Please sign in to comment.