Skip to content

Releases: khonsulabs/pot

v3.0.1

18 Aug 20:32
7f533f2
Compare
Choose a tag to compare

Added

  • Compatibility is a new enum that controls compatibility of serialization and
    deserialization. Compatibility::Full is the default compatibility level in
    v3.x, and it serializes data in a way that even Pot v1.0 deserializers can
    deserialize.

    Compatibility::V4 is a new serialization format that serializes enum
    variants without associated data in a way that allows Value deserialization
    to be done unambiguously. See #11 for an example of this issue. This bug
    only affected deserialize_any-type deserialization. Typical deserialization
    works correctly.

    Compatibility can be configured using these new APIs:

    • Config::compatibility
    • Serializer::new_with_compatibility
    • SymbolMap::with_compatibility
    • SymbolMap::set_compatibility

v3.0.0

24 Aug 16:16
7a1ac59
Compare
Choose a tag to compare

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

v2.0.0

28 Feb 16:36
3d13632
Compare
Choose a tag to compare

Breaking Changes

  • The format module has been refactored to pass Write by value rather than
    by mutable reference. Most code should not be affected because Write is
    implemented for &mut Write.

Changed

  • The unit type () and Option::None are more fuzzy when deserializing. If
    users deserialize a value that was serialized as None or (), the default
    value will be returned rather than an error, when possible. For example:

    let unit = pot::to_vec(&())?;
    assert_eq!(pot::from_slice(&unit).unwrap(), 0_u32)
    let none = pot::to_vec(&Option::<bool>::None)?;
    assert_eq!(pot::from_slice(&unit).unwrap(), 0_u32)

    This is not practically useful for most users, but when designing traits that
    have associated serializable types, sometimes it's useful to use () when no
    data needs to be stored. However, it can be painful to update existing data
    when switching between () and other types, as Serde offers no built-in
    transmutation. Pot now offers this internally.

Added

  • Value::from_serialize and Value::deserialize_as have been added, allowing
    Value to be transmuted directly from types that implement Serialize and
    Deserialize.
  • OwnedValue is a new-type wrapper around Value<'static> that can be used in
    situations where DeserializeOwned is a requirement. This type is needed
    because Value<'a> can borrow from the source of the deserialization, and
    this flexibility causes lifetime errors when trying to deserialize a
    Value<'static> as DeserializeOwned.

v1.0.2

09 Apr 22:27
b886994
Compare
Choose a tag to compare

Fixed

  • #5: Removed release_max_level_off feature flag from tracing dependency. Thank you to @rrichardson for reporting this!

v1.0.1

10 Feb 15:52
4e46cb4
Compare
Choose a tag to compare

Added

  • serde(flatten) is now supported.

v1.0.0

04 Feb 22:28
5c1b9a4
Compare
Choose a tag to compare

There are no code changes in this release.

v1.0.0-rc.4

25 Jan 15:13
6c46bf0
Compare
Choose a tag to compare
v1.0.0-rc.4 Pre-release
Pre-release

Changed

  • Fixed compilation error caused by a new dependency upgrade.

v1.0.0-rc.3

31 Dec 15:45
9de20e3
Compare
Choose a tag to compare
v1.0.0-rc.3 Pre-release
Pre-release

Changed

  • from_reader and Config::deserialize_from to DeserializeOwned. This
    prevents errors at compile time that would arise at runtime when deserializing
    instead.

v1.0.0-rc.2

27 Dec 21:24
a926150
Compare
Choose a tag to compare
v1.0.0-rc.2 Pre-release
Pre-release

Added

  • Config now implements Clone and Debug.

v1.0.0-rc.1

24 Dec 00:24
f287b1a
Compare
Choose a tag to compare
v1.0.0-rc.1 Pre-release
Pre-release

This release focused on adding more unit tests to test both positive and negative flows. At the release of v0.1.0-alpha.3, the code coverage reported at 79.65%. This release brings that metric to 92.78%, and some of the missing coverage is due to the coverage tools not working fully in certain circumstances. The current report can always be viewed here.

Added

  • Added the Value type, allowing deserializing arbitrary Pot payloads without its
    original data structure.

Fixed

  • Small fixes when packing floats and integers. No breaking changes, as the
    incorrect code would just use more space than needed for certain values.