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.
- 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
::core
inDecode
derivation (caused compilation error whenno-implicit-prelude
was used).
- Trying to deserialize a boxed newtype containing a big array won't overflow the stack anymore.
- Deriving
Decode
will not trigger clippy warnings anymore
- Added
Decode::decode_into
to allow deserializing into unitialized memory. - Added a
DecodeFinished
type 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
derive
feature is enabled, as opposed to how it was previously where enablingparity-scale-codec-derive
would suffice. - The
max-encoded-len
feature won't automatically enable the derive macros nor pull in theparity-scale-codec-derive
dependency.
ConstEncodedLen
marker 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
full
are not unconditionally implemented.
This release exports decode_vec_with_len
to support custom decoding of Vec
s.
- 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
MaxEncodedLen
on 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::decode
for[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
CompactRef
public 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_limit
to theDecodeLimit
trait. 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 MaxEncodedLen
trait for items that have a statically known maximum encoded size. (#268)#[codec(crate = <path>)]
top-level attribute to be used with the newMaxEncodedLen
trait, which allows to specify a different path to the crate that contains theMaxEncodedLen
trait. Useful when using generating a type through a macro and this type should implementMaxEncodedLen
and the final crate doesn't haveparity-scale-codec
as dependency.
- Lint attributes now pass through to the derived impls of
Encode
,Decode
andCompactAs
. 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
Decode
derive macro. Pr #254
Decode::skip
allows to skip some encoded types. Pr #243Decode::encoded_fixed_size
allows to get the fixed encoded size of a type. PR #243Error
now contains a chain of causes. This full error description can also be activated on no std using the featurechain-error
. PR #242Encode::encoded_size
allows to get the encoded size of a type more efficiently. PR #245
CompactAs::decode_from
now 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
bitvec
andgeneric-array
is updated. Encode::encode_to
now bounds the genericW: Output + ?Sized
instead ofW: Output
.Output
can now be used as a trait object.
EncodeAppend::append
is removed in favor ofEncodeAppend::append_or_new
.Output::push
is removed in favor ofEncode::encode_to
.- Some bounds on
HasCompact::Type
are removed. Error::what
is removed in favor ofError::to_string
(implemented through traitDisplay
).Error::description
is removed in favor ofError::to_string
(implemented through traitDisplay
).