Skip to content

serde_with v1.10.0

Compare
Choose a tag to compare
@github-actions github-actions released this 04 Sep 20:30
4087080

Added

  • Add BorrowCow which instructs serde to borrow data during deserialization of Cow<'_, str>, Cow<'_, [u8]>, or Cow<'_, [u8; N]>. (#347)
    The implementation is for serde#2072 and serde#2016, about #[serde(borrow)] not working for Option<Cow<'a, str>>.

    #[serde_as]
    #[derive(Deserialize, Serialize)]
    struct Data<'a> {
        #[serde_as(as = "Option<[BorrowCow; 1]>")]
        nested: Option<[Cow<'a, str>; 1]>,
    }

    The #[serde(borrow)] annotation is automatically added by the #[serde_as] attribute.

Changed

  • Bump MSRV to 1.46, since the dev-dependency bitflags requires that version now.
  • flattened_maybe! no longer requires the serde_with crate to be available with a specific name.
    This allows renaming the crate or using flattened_maybe! through a re-export without any complications.