Releases: Marcono1234/struson
Releases · Marcono1234/struson
Struson 0.7.2
Changes
- Fixed docs.rs build
There are no other changes; from a user perspective this is identical to Struson 0.7.1.
Struson 0.7.1
Changes
- Minimum Rust version (MSRV) is now 1.85.0; the project now uses Rust 2024 Edition
JsonStreamWriterdoes not perform any buffering anymore
Depending on the use case astd::io::BufWritershould be used, for example when writing to a file or a network connection. It is still necessary to callJsonStreamWriter::finish_document()when writing is done.- Added
JsonStreamWriter::finish_document_no_flush()
This allows avoiding the call toflushon the underlyingWrite(#153). - Switched dependency from
serdetoserde_core
Only affects users of theserdefeature of Struson. This change should not have any effect on the Struson API or your usage of Struson, but it can improve the build time.
Note
Version 0.7.1 is identical to version 0.7.0; there was a problem with the publishing workflow which is why the version bump commit and the Git tag for 0.7.0 are missing from the repository.
Struson 0.6.0
Changes
- Specified the
rust-versioninCargo.toml(Minimum Supported Rust Version); currently it is 1.75.0 - Changed
JsonStreamReaderto disallow control characters in comments (if enabled withReaderSettings::allow_comments) - Removed deprecated
parse_json_pathfunction, use thejson_path!macro instead - Added associated type
WriterResulttoJsonWriter, which is returned byJsonWriter::finish_document
ForJsonStreamWriterthe result is the underlyingWrite, which allows for example to reuse it for different purposes.
Simple API
- (Breaking) Renamed Cargo feature for enabling Simple API from
experimentaltosimple-api - Added
ObjectWriter::write_memberto allow writing the value of a member using aValueWriter
Struson 0.5.0
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 ifJsonPathPiecehad not been imported) - Fixed
UnexpectedStructureKind::to_stringnot including field values - Added
JsonReader::seek_backas opposite ofseek_to(#53)
Simple API
- (Breaking) Removed structs
ArrayItemReaderandMemberValueReaderin favor of the new common structSingleValueReader - 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
ValueReadermethods:read_strfor reading a JSON string value as borrowedstrread_seekedandread_seeked_multifor making it easier to seek to values and read them (#48, #49)
Especiallyread_seeked_multican be quite useful for reading for example all values of nested JSON arrays or objects; see its documentation for examples.read_string_with_readerfor reading large string values in a streaming way (#54)
- New
ValueWritermethods:write_string_with_writerfor writing large string values in a streaming way (#54)
Struson 0.4.1
Changes
Serde serialization:
- Fixed spurious
SerializerError::IncorrectElementsCountwhen skipping fields (#41)
Struson 0.4.0
Breaking changes
- Marked some error enum types as
non_exhaustive struson::serde::DeserializerErrorenum variantsParseIntErrorandParseFloatErrorhave been replaced with new variantInvalidNumberReaderError::IoErrorvariant has been changed to a struct which now includes the error location- Improved
JsonErrorLocationstructure; renamed it toJsonReaderPosition - Changed return type of
JsonReader::next_string_readerandJsonWriter::string_value_writerto useimpl Trait(#18)
When using those methods it might be necessary to add additionalusedeclarations forReadand forWriteandStringValueWriter.
Major changes
- Experimental "simple API" (#34)
API enforces correct usage at compile time, instead of panicking at runtime (as done byJsonReaderandJsonWriter).
Feedback is highly appreciated!
Changes
- Adjusted Serde integration to match serde_json 1.0.111 behavior (with some minor differences)
JsonStreamReadernow keeps retrying to read data in case an error of kindErrorKind::Interruptedoccurs
This is consistent with the current behavior ofJsonStreamWriter, and avoids reading potentially incorrect data when using default methods such asRead::read_exacton the string value reader returned byJsonReader::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.lockin repository - Fixed line number for
TrailingCommaNotEnabledsyntax 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
Breaking changes
- Changed number traits used by
JsonWritermethodsnumber_valueandfp_number_value
This most likely only affects customJsonWriterimplementations. See below for details.
Changes
- Fixed
JsonStreamReader::next_namesometimes returning wrong results (#10) - Added
StringValueWriter::write_str - Tried to improve number reading and number string writing performance
- Tried to improve
JsonStreamReader::transfer_toperformance for string values - Adjusted number traits used by
JsonWritermethodsnumber_valueandfp_number_value
These changes are mainly relevant for custom implementations ofJsonWriter.IntegralNumberhas been renamed toFiniteNumberto better describe its behavior- Number traits no longer have
ToStringandCopyas supertraits; instead they have a newuse_json_numbermethod to consume astr - Number traits have new methods to obtain the value as
u64/i64, respectivelyf64
Struson 0.2.0
Breaking changes
- Removed
ReaderSettings::update_path_during_skip; use the newReaderSettings::track_pathto completely disable path tracking instead - The return type of
JsonReader::next_namehas changed fromStringtostr; use the new methodnext_name_ownedto directly obtain aString
Changes
- Added
ReaderSettings::track_pathto allow disabling path tracking for better performance - Added
JsonReadermethods for reading values asstr; if only astris needed these methods will be more performant memory-wise than the methods returning aStringnext_name(the existingnext_namemethod has been renamed tonext_name_owned)next_strnext_number_as_str
Struson 0.1.0
Initial release