Skip to content

v3.0.0

Compare
Choose a tag to compare
@ecton ecton released this 24 Aug 16:16
· 6 commits to main since this release
7a1ac59

Breaking Changes

  • #9Value::from_serialize now returns a Result. Previously, if a Serialize
    implementation returned an error, the function would panic. Thanks to
    @wackbyte for finding this.

  • Reader::buffered_read_bytes now takes a third parameter, scratch: &mut Vec<u8> and returns a new type BufferedBytes. This allows callers to supply
    a buffer for reading bytes into rather than requiring implementors allocate
    new buffers.

  • PartialEq for Value has been changed such that if the bytes contained by a
    string match the bytes contained by a byte value, the values now compare as
    equal. Previously, all discriminants required exact matches.

    This was done due to Pot not knowing whether a value is a string or bytes when
    serialized. Bytes are auto-promoted to string if the bytes are valid UTF-8 in
    Value deserialization.

  • SymbolMap now utilizes a new structure SymbolList for managing symbols.
    This type optimizes storage of symbols when they are not borrowed from the
    deserialization source.

  • format::write_atom_header no longer accepts an option for the arg
    parameter.

  • format::read_atom now accepts a scratch: &mut Vec<u8> parameter which is
    used when reading an associated Nucleus::Bytes. When Nucleus::Bytes
    contains BufferedBytes::Scratch, scratch will contain the bytes contained
    in the atom.

  • SymbolMapRef is now a struct with private contents.

  • Error is now #[non_exhaustive].

  • format::Float and format::Integer no longer implement
    Serialize/Deserialize. These implementations were derived but never
    actually used. To improve this crate's build parallelization, a decision was
    made to remove these usages of serde's derive macro. Implementing these traits
    would be trivial, but the crate maintainer doesn't believe anyone is actually
    using these implementations, so they were intentionally skipped. Please file
    an issue if this affected you and you would like to see these implementations
    added again.

Changed

  • pot::Result<T> is now pot::Result<T,E = pot::Error>. This avoids issues
    with other code when pot::Result is imported.
  • ValueIter is now exported. This is the type returned from Value::values().
  • The Minimum Supported Rust Version (MSRV) has been set to 1.70. This MSRV was
    chosen at the time due to dependencies also requiring this MSRV.
  • Tracing instrumentation has been changed from the default level of INFO to
    TRACE.
  • This crate no longer activates the derive feature of serde.

Added

  • OwnedValue now implements From for Value<'_> and &Value<'_>.

  • Value now implements FromIterator<T> where T: Into<Value<'a>>. The
    result will be the variant Value::Sequence.

  • Value now implements FromIterator<(K, V)> where K: Into<Value<'a>>, V: Into<Value<'a>>. The result will be the variant Value::Mappings.

  • de::SymbolMap and ser::SymbolMap now both implement Serialize and
    Deserialize using the same serialization strategy. This allows preshared
    dictionaries to be used, and for state to be saved and restored.

  • de::SymbolMap and ser::SymbolMap have new convenience methods that allow
    serializing and deserializing values directly:

    • de::SymbolMap::deserialize_slice
    • de::SymbolMap::deserialize_from
    • ser::SymbolMap::serialize_to_vec
    • ser::SymbolMap::serialize_to