Skip to content

Releases: Marcono1234/struson

Struson 0.5.0

17 Mar 12:46
Compare
Choose a tag to compare

Changes

  • Added support for trailing comma for json_path!
  • Fixed json_path! not using full type path when creating empty array
    (could probably have lead to compilation errors if JsonPathPiece had not been imported)
  • Fixed UnexpectedStructureKind::to_string not including field values
  • Added JsonReader::seek_back as opposite of seek_to (#53)

Simple API

  • (Breaking) Removed structs ArrayItemReader and MemberValueReader in favor of the new common struct SingleValueReader
  • Reader and writer will keep returning errors after the first error (#55)
    This is intended as safeguard in case an error is accidentally not propagated by a closure or function provided by the user. However, users should not rely on this behavior, and instead use Rust's ? operator for propagating reader and writer errors.
  • New ValueReader methods:
    • read_str for reading a JSON string value as borrowed str
    • read_seeked and read_seeked_multi for making it easier to seek to values and read them (#48, #49)
      Especially read_seeked_multi can be quite useful for reading for example all values of nested JSON arrays or objects; see its documentation for examples.
    • read_string_with_reader for reading large string values in a streaming way (#54)
  • New ValueWriter methods:
    • write_string_with_writer for writing large string values in a streaming way (#54)

Struson 0.4.1

30 Jan 20:54
Compare
Choose a tag to compare

Changes

Serde serialization:

  • Fixed spurious SerializerError::IncorrectElementsCount when skipping fields (#41)

Struson 0.4.0

21 Jan 20:00
Compare
Choose a tag to compare

Breaking changes

  • Marked some error enum types as non_exhaustive
  • struson::serde::DeserializerError enum variants ParseIntError and ParseFloatError have been replaced with new variant InvalidNumber
  • ReaderError::IoError variant has been changed to a struct which now includes the error location
  • Improved JsonErrorLocation structure; renamed it to JsonReaderPosition
  • Changed return type of JsonReader::next_string_reader and JsonWriter::string_value_writer to use impl Trait (#18)
    When using those methods it might be necessary to add additional use declarations for Read and for Write and StringValueWriter.

Major changes

  • Experimental "simple API" (#34)
    API enforces correct usage at compile time, instead of panicking at runtime (as done by JsonReader and JsonWriter).
    Feedback is highly appreciated!

Changes

  • Adjusted Serde integration to match serde_json 1.0.111 behavior (with some minor differences)
  • JsonStreamReader now keeps retrying to read data in case an error of kind ErrorKind::Interrupted occurs
    This is consistent with the current behavior of JsonStreamWriter, and avoids reading potentially incorrect data when using default methods such as Read::read_exact on the string value reader returned by JsonReader::next_string_reader().
  • Improve string value reader (JsonReader::next_string_reader()) and string value writer (JsonWriter::string_value_writer()) error behavior
    Now when an error occurs, any subsequent read and write attempts will return an error as well.
  • Included Cargo.lock in repository
  • Fixed line number for TrailingCommaNotEnabled syntax error being incorrect if line breaks are after comma
  • Added tracking of byte position for JsonStreamReader
  • Added JsonReader::current_position(...) method for obtaining the current position of the JSON reader (#14)
  • Added JsonStreamReader::reader_mut() for obtaining reference to underlying reader (#25)
  • Added nesting limit for JsonStreamReader (#28)
  • Added support for no arguments for json_path!

Struson 0.3.0

05 Sep 23:01
Compare
Choose a tag to compare

Breaking changes

  • Changed number traits used by JsonWriter methods number_value and fp_number_value
    This most likely only affects custom JsonWriter implementations. See below for details.

Changes

  • Fixed JsonStreamReader::next_name sometimes returning wrong results (#10)
  • Added StringValueWriter::write_str
  • Tried to improve number reading and number string writing performance
  • Tried to improve JsonStreamReader::transfer_to performance for string values
  • Adjusted number traits used by JsonWriter methods number_value and fp_number_value
    These changes are mainly relevant for custom implementations of JsonWriter.
    • IntegralNumber has been renamed to FiniteNumber to better describe its behavior
    • Number traits no longer have ToString and Copy as supertraits; instead they have a new use_json_number method to consume a str
    • Number traits have new methods to obtain the value as u64 / i64, respectively f64

Struson 0.2.0

06 Aug 18:57
Compare
Choose a tag to compare

Breaking changes

  • Removed ReaderSettings::update_path_during_skip; use the new ReaderSettings::track_path to completely disable path tracking instead
  • The return type of JsonReader::next_name has changed from String to str; use the new method next_name_owned to directly obtain a String

Changes

  • Added ReaderSettings::track_path to allow disabling path tracking for better performance
  • Added JsonReader methods for reading values as str; if only a str is needed these methods will be more performant memory-wise than the methods returning a String
    • next_name (the existing next_name method has been renamed to next_name_owned)
    • next_str
    • next_number_as_str

Struson 0.1.0

22 Apr 15:09
Compare
Choose a tag to compare

Initial release