The format is based on Keep a Changelog.
This release makes scale-value entirely no_std which is now using core::error::Error instead of std::error::Error as it was using before behind the std feature. Because of that the std feature is now removed and the MSRV is bumped to 1.81.0. In addition it bumps a few dependencies to their latest versions.
- Remove std feature and make the crate fully no_std
- Update
scale-decode
to v0.16.0 - Update
scale-encode
to v0.10.0 - Update
yap
to v0.12.0 - Update
scale-bits
to v0.7.0 - Remove
scale-info
dependency and the re-export PortableRegistry - Bump MSRV to 1.81.0
- Replace
derive_more
withthiserror
This release:
- Bumps
derive_more
from 0.99 to 1.0 (#57) - Bumps
scale-decode
from 0.13 to 0.14 (#58) - Bumps
scale-encode
from 0.7 to 0.8 (#59) - Removes
frame-metadata
dependency (#60)
This release exports scale_value::scale::ValueVisitor<TypeResolver>
, allowing the values to be created from functions like scale_decode::visitor::decode_with_visitor
.
This release adds scale_value::stringify::to_writer
and scale_value::stringify::to_writer_custom
(to align with the already present scale_value::stringify::from_str_custom
), and also exposes a new scale_value::stringiy::custom_formatters
containing a formatter for displaying things as hex.
scale_value::stringify::to_writer_custom
allows for custom formatting of values, including a "pretty" spaced/indented formatting and a "compact" formatting which removes all unnecessary spaces. It also allows customising of the indentation and for custom formatters to be applied, as well as displaying the contexts of values if desired.
See #52 for more information.
This release:
- Adds a "tracing decoder" (via
scale_value::scale::tracing::{decode_as_type,*}
), which is likescale_value::scale::decode_as_type
, but traces and hands back much more detail in case of a decoding failure, so that it's easier to track down where decoding failed. This is particularly useful when working with historic type information, which must be provided independently and could easily be misaligned with reality. (#52)
This release:
- Bumps
scale-decode
to its latest version (0.13.0).
- Fix an infinite loop when trying to encode Composite values of the wrong shape ((#48)[#48])
This release bumps scale-type-resolver
, scale-encode
, scale-decode
and scale-bits
to their latest versions.
A scale_value::decode_as_fields
function was added that can decode a series of values from some bytes given an iterator of type ids. Previously it was only possible through the scale_decode::DecodeAsFields
implementation of scale_value::Composite<()>
. With the new function scale_value::Composite<R::TypeId>
's can be decoded for any type resolver R
.
The crate now uses scale-type-resolver
to be generic over the provider of type information that is used when encoding and decoding Value
s.
One implication is that scale_decode::IntoVisitor
is now only implemented for Value<()>
and no longer for Value<u32>
. So Value::decode_from_type()
cannot be used anymore to create a Value<u32>
that keeps type id information. Instead you now use scale_value::scale::decode_as_type()
which can return the desired Value<u32>
.
This release:
- Bumps
scale-decode
to its latest version.
Bumps scale-encode
and scale-decode
to their latest versions (0.5 and 0.9 respectively).
One effect that this has is that structs containing compact encoded values, after being encoded, now decode to composite types that better
reflect their original shape. For example, Compact(MyWrapper { inner: 123 })
, when encoded, used to decode to Value::u128(123)
,
but now it decodes to Value::named_composite(vec![("inner", Value::u128(123))]).
- Adds support for
no_std
environments; disable the "std" feature flag for this. (#38) This PR makes a couple of small breaking changes:- The
from_string
feature flag is nowfrom-string
. - Some sub-
ErrorKind
's infrom_string
no logner implstd::error::Error
. ParseErrorKind::Custom
errors are now strings rather than boxedstd::error::Error
s to play nicer withno_std
.
- The
- Adds a
value!
macro to make constructingValue
's much easier; thinkserde_json::value!
. (#36)
- Bumps
scale-encode
andscale-decode
to their latest versions (0.4 and 0.8 respectively).
This release:
- bumps
scale-encode
andscale-decode
to their latest versions.
This release:
- bumps
scale-encode
andscale-decode
to their latest versions.
This patch release:
- Changes how composite
Value
's are encoded to improve the likelihood that values will encode correctly. (#32)
This release:
- Bumps to using
scale-info
2.5.0 and uses field rather than method accessors as introduced by that change. - Introduces
scale_value::stringify::from_str_custom()
, which allows you to construct aValue
parser that can inject custom parsing logic while parsing strings into Values. - Adds two new custom parsers in a new
stringify::custom_parsers
module for parsing hex values and ss58 addresses. These can be used in conjunction with the above. - Fixes a small bug in stringifying so that field and enum idents are no longer quoted unless necessary; this will make the output prettier.
There should be no breaking API changes.
- Add hex and ss58 custom parsers. (#29)
- Improve stringifying and add support for custom parsers. (#26)
The main change in this release is that it makes use of a new scale-encode
crate and updated scale-decode
crate for the SCALE encoding and decoding of Values.
- Values now implement
DecodeAsType
andEncodeAsType
. - Composites now implement
DecodeAsFields
. - As a small breaking API change, the
TypeId
passed to the encode and decode methods is now a plainu32
for simplicity, rather than a newtype struct.
It should be very straightforward to update to this release as the changes are mainly additive in nature.
- Use latest
scale-decode
and newscale-encode
crate for SCALE encoding and decoding Values. (#25)
Here we move to scale_bits
from bitvec
to handle our encode/decode logic and provide a simple type to decode bits into. We also now add a WASM CI test, and will expect this crate (potentially via features in the future) to be WASM compatible.
- Use
scale-bits
forBitSequence
decoding etc and enable WASM test. (#24)
The main user-facing change in this release is that the SCALE bytes for compact-encoded structs previously decoded into Composite
values with the same degree of nesting (ie if the compact encoded value was nested within 2 structs, it would be decoded into a value nested inside 2 Composite
s). This nesting has now been removed, and the compact value is returned directly. This should have no impact on re-encoding the Value, since encoding into single-field composites will just delegrate to the inner field type as needed.
Internally, the SCALE decoding logic has mostly moved to scale-decode
, simplifying the logic in this crate (and exposing a more general/lower level decoding interface via that crate).
Full list of changes:
- Use
scale-decode
forValue
decoding. (#22)
The main addition in this release is the At
trait (and corresponding .at()
method) for indexing into Value
s. There are also various small breaking changes as a result of tidying up various constructors, which will hopefully in general allow you to construct Value
s with a little less verbosity. The uint
/int
constructors have been made more consistent with their siblings and have been renamed to u128
and i128
.
Full list of changes:
- Index into values with at, and more generic/extra accessors/constructors. (#19)
This release introduces a small breaking change: scale_value::scale::encode_value_as_type
now takes a reference to a value rather than ownership of it, since on the happy path this shouldnt affect performance, and it would often mean cloning the entire value before passing it in, anyway.
Full list of changes:
- SCALE encoding now accepts a reference, and make encoding slightly more flexible w.r.t newtype wrappers. (#17)
- Fix compile error on 32-bit architectures owing to BitVec not supporting a store type of u64 on them. Also fix an internal naming mixup w.r.t bitvec types. (#12)
- Added a string syntax for values, and the ability to parse
Value
's from strings or encode them into strings (see the newstringify
module exposed at the crate root). Parsing from strings requires thefrom_string
feature to be enabled. (#7)
The initial release.
- Added a
Value
type that can be SCALE encoded and decoded using ascale_info::PortableRegistry
, as well as serialized and deserialized to things viaserde
. (#1)