Releases: Marcono1234/struson
Releases · Marcono1234/struson
Struson 0.6.0
Changes
- Specified the
rust-version
inCargo.toml
(Minimum Supported Rust Version); currently it is 1.75.0 - Changed
JsonStreamReader
to disallow control characters in comments (if enabled withReaderSettings::allow_comments
) - Removed deprecated
parse_json_path
function, use thejson_path!
macro instead - Added associated type
WriterResult
toJsonWriter
, which is returned byJsonWriter::finish_document
ForJsonStreamWriter
the 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
experimental
tosimple-api
- Added
ObjectWriter::write_member
to 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 ifJsonPathPiece
had not been imported) - Fixed
UnexpectedStructureKind::to_string
not including field values - Added
JsonReader::seek_back
as opposite ofseek_to
(#53)
Simple API
- (Breaking) Removed structs
ArrayItemReader
andMemberValueReader
in 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
ValueReader
methods:read_str
for reading a JSON string value as borrowedstr
read_seeked
andread_seeked_multi
for making it easier to seek to values and read them (#48, #49)
Especiallyread_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
Changes
Serde serialization:
- Fixed spurious
SerializerError::IncorrectElementsCount
when skipping fields (#41)
Struson 0.4.0
Breaking changes
- Marked some error enum types as
non_exhaustive
struson::serde::DeserializerError
enum variantsParseIntError
andParseFloatError
have been replaced with new variantInvalidNumber
ReaderError::IoError
variant has been changed to a struct which now includes the error location- Improved
JsonErrorLocation
structure; renamed it toJsonReaderPosition
- Changed return type of
JsonReader::next_string_reader
andJsonWriter::string_value_writer
to useimpl Trait
(#18)
When using those methods it might be necessary to add additionaluse
declarations forRead
and forWrite
andStringValueWriter
.
Major changes
- Experimental "simple API" (#34)
API enforces correct usage at compile time, instead of panicking at runtime (as done byJsonReader
andJsonWriter
).
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 kindErrorKind::Interrupted
occurs
This is consistent with the current behavior ofJsonStreamWriter
, and avoids reading potentially incorrect data when using default methods such asRead::read_exact
on 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.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
Breaking changes
- Changed number traits used by
JsonWriter
methodsnumber_value
andfp_number_value
This most likely only affects customJsonWriter
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
methodsnumber_value
andfp_number_value
These changes are mainly relevant for custom implementations ofJsonWriter
.IntegralNumber
has been renamed toFiniteNumber
to better describe its behavior- Number traits no longer have
ToString
andCopy
as supertraits; instead they have a newuse_json_number
method 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_path
to completely disable path tracking instead - The return type of
JsonReader::next_name
has changed fromString
tostr
; use the new methodnext_name_owned
to directly obtain aString
Changes
- Added
ReaderSettings::track_path
to allow disabling path tracking for better performance - Added
JsonReader
methods for reading values asstr
; if only astr
is needed these methods will be more performant memory-wise than the methods returning aString
next_name
(the existingnext_name
method has been renamed tonext_name_owned
)next_str
next_number_as_str
Struson 0.1.0
Initial release