All notable changes to this crate are documented in this file.
The format is based on Keep a Changelog, and this crate adheres to Semantic Versioning.
- Implement
on_before_alloc_mem()forCountedInput#716 - Fix derive(Decode) for enums with lifetime parameters and struct-like variants #726
- Fix performance regression (#731)
- Fix
DecodeWithMemTrackingbounds forCow#735
- Disallow duplicate indexes using constant evaluation (#653)
- Fix added bounds in
Encodeand other derive macros. (#689)
- Allow decoding with a memory limit. (616)
- Introduce
CountedInput, an wrapper onInputthat counts the bytes read. (630)
- This release bumps some dependencies, primarily bumping
synto 2. (#640).
- Fix MaxEncodedLen derive macro for enum with skipped variant (#622)
- Use MAX_PREALLOCATION consistently #605
- Now
#[derive(Encode)]implements thesize_hint()method for structures and enumerations. This improves the performance of theencode()method by pre-allocating memory.
- Provide full path to elements from
::coreinDecodederivation (caused compilation error whenno-implicit-preludewas used).
- Trying to deserialize a boxed newtype containing a big array won't overflow the stack anymore.
- Deriving
Decodewill not trigger clippy warnings anymore
- Added
Decode::decode_intoto allow deserializing into unitialized memory. - Added a
DecodeFinishedtype to be used withDecode::decode_into.
- Trying to deserialize a big boxed array (e.g.
Box<[u8; 1024 * 1024 * 1024]>) won't overflow the stack anymore. - Trying to deserialize big nested enums with many variants won't overflow the stack anymore.
- Elements of partially read arrays will now be properly dropped if the whole array wasn't decoded.
- The derive macros will now be reexported only when the
derivefeature is enabled, as opposed to how it was previously where enablingparity-scale-codec-derivewould suffice. - The
max-encoded-lenfeature won't automatically enable the derive macros nor pull in theparity-scale-codec-derivedependency.
ConstEncodedLenmarker trait for types that implementMaxEncodedLen. #428
This release renders the full feature defunct. The implementations guarded behind
this feature are now always provided.
- All implementations guarded behind
fullare not unconditionally implemented.
This release exports decode_vec_with_len to support custom decoding of Vecs.
- Export
decode_vec_with_len.
This release fixes compilation on no-std envs.
- Use core RangeInclusive instead of std #378
This release (specifically #375) bumps the MSRV to 1.60.0 as it depends on the Cargo.toml weak dependency feature.
- Don't include bitvec with std feature unless asked for explicitly. #375
- Implement
MaxEncodedLenon more core lib types. #350
A quick release to fix an issue introduced in 3.1.4 that broke compiling on no-std.
- Fix compiling on no-std. (see https://github.com/paritytech/parity-scale-codec/commit/c25f14a46546c75e4208363ced9d89aa81c85e7f)
Be aware that version 3.0.0. up to 3.1.1 contained some bugs in the BitVec encoder that could lead to an invalid encoding. Thus, we yanked these crate version and it is advised to upgrade to 3.1.2. Any release before 3.0.0 wasn't affected by this bug.
- Optimised the
Decode::decodefor[T; N]by @xgreenx. #299 - Add some doc for the derive macro by @thiolliere. #301
- Add bytes::Bytes implementation by @vorot93. #309
- Upgrade to BitVec 1.0 by @bkchr. #311
- BREAKING CHANGE: DecodeLimit and DecodeAll extensions now advance input by @wigy-opensource-developer. #314
- Make
CompactRefpublic by @andrenth. #321 - Add ability to re-export parity-scale-codec crate by @gshep. #325
- BitVec: Improve the encoding and consolidate the implementations by @bkchr. #327
- Fix crate access by putting a leading
::by @bkchr. #328
- Optimised the Decode::decode for [T; N] #299
- Migrated to 2021 edition, enforcing MSRV of
1.56.1. #298 - Upgrade to BitVec 1.0 #311
- DecodeLimit and DecodeAll extensions now advance input #314
- Add bytes::Bytes implementation #309
decode_and_advance_with_depth_limitto theDecodeLimittrait. This allows advancing the cursor while decoding the input. PR #286
- Add support for custom where bounds
codec(mel_bound(T: MaxEncodedLen))when deriving the traits. PR #279 MaxEncodedLentrait for items that have a statically known maximum encoded size. (#268)#[codec(crate = <path>)]top-level attribute to be used with the newMaxEncodedLentrait, which allows to specify a different path to the crate that contains theMaxEncodedLentrait. Useful when using generating a type through a macro and this type should implementMaxEncodedLenand the final crate doesn't haveparity-scale-codecas dependency.
- Lint attributes now pass through to the derived impls of
Encode,DecodeandCompactAs. PR #272
- Add support for custom where bounds
codec(encode_bound(T: Encode))andcodec(decode_bound(T: Decode))when deriving the traits. Pr #262 - Switch to const generics for array implementations. Pr #261
- Fix type inference issue in
Decodederive macro. Pr #254
Decode::skipallows to skip some encoded types. Pr #243Decode::encoded_fixed_sizeallows to get the fixed encoded size of a type. PR #243Errornow contains a chain of causes. This full error description can also be activated on no std using the featurechain-error. PR #242Encode::encoded_sizeallows to get the encoded size of a type more efficiently. PR #245
CompactAs::decode_fromnow returns result. This allow for decoding to fail from their compact form.- derive macro use literal index e.g.
#[codec(index = 15)]instead of#[codec(index = "15")] - Version of crates
bitvecandgeneric-arrayis updated. Encode::encode_tonow bounds the genericW: Output + ?Sizedinstead ofW: Output.Outputcan now be used as a trait object.
EncodeAppend::appendis removed in favor ofEncodeAppend::append_or_new.Output::pushis removed in favor ofEncode::encode_to.- Some bounds on
HasCompact::Typeare removed. Error::whatis removed in favor ofError::to_string(implemented through traitDisplay).Error::descriptionis removed in favor ofError::to_string(implemented through traitDisplay).