Skip to content

Struson 0.4.0

Compare
Choose a tag to compare
@Marcono1234 Marcono1234 released this 21 Jan 20:00
· 68 commits to main since this release

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!