Skip to content

serde_with v1.8.0

Compare
Choose a tag to compare
@github-actions github-actions released this 30 Mar 21:55
4864268

Added

  • Added PickFirst adapter for serde_as. #291
    It allows to deserialize from multiple different forms.
    Deserializing a number from either a number or string can be implemented like:

    #[serde_as(as = "PickFirst<(_, DisplayFromStr)>")]
    value: u32,
  • Implement SerializeAs/DeserializeAs for more wrapper types. #288, #293
    This now supports:

    • Arc, sync::Weak
    • Rc, rc::Weak
    • Cell, RefCell
    • Mutex, RwLock
    • Result

Changed

  • Add a new serde_with::rust::map_as_tuple_list module as a replacement for serde_with::rust::btreemap_as_tuple_list and serde_with::rust::hashmap_as_tuple_list.
    The new module uses IntoIterator and FromIterator as trait bound making it usable in more sitations.
    The old names continue to exist but are marked as deprecated.

Deprecated

  • Deprecated the module names serde_with::rust::btreemap_as_tuple_list and serde_with::rust::hashmap_as_tuple_list.
    You can use serde_with::rust::map_as_tuple_list as a replacement.

Fixed

  • Implement Timestamp*Seconds and Duration*Seconds also for chrono types.
    This closes #194. This was incompletely implemented in #199.