Crate scale_value
source ·Expand description
This crate exposes the Value type and related subtypes, which are used as the runtime
representations of SCALE encoded data (much like serde_json::Value is a runtime representation
of JSON data).
Value’s can be:
- Encoded and decoded from SCALE bytes via ::scale_encode::EncodeAsTypeand::scale_decode::DecodeAsTypetraits (or by callingcrate::scale::decode_as_typeandcrate::scale::encode_as_type).
- Parsed to and from strings by calling crate::stringify::from_strandcrate::stringify::to_string). Parsing from strings requires thefrom_stringfeature to be enabled.
- Serialized and deserialized via serdetraits (for example, to and from JSON). They can also be serialized from and to other types with the relevant serde derives on. These require theserdefeature to be enabled.
- Accessed ergonomically via the Attrait.
Modules§
- Encoding and decoding SCALE bytes into acrate::Value.
- Serializing and deserializing acrate::Valueinto/from other types via serde.
- Converting acrate::Valueto or from strings.
Macros§
- Construct ascale_value::Value
Structs§
- This represents a sequence of boolean values, packed into bits.
- A struct representing a location to access in aValue.
- Valueholds a representation of some value that has been decoded, as well as some arbitrary context.
- This represents the value of a specific variant from an enum, and contains the name of the variant, and the named/unnamed values associated with it.
Enums§
- A named or unnamed struct-like, array-like or tuple-like set of values. This is used to represent a range of composite values on their own, or as values for a specificVariant.
- A “primitive” value (this includes strings).
- The underlying shape of a given value.
Traits§
- This trait allows indexing intoValues (and options ofValues) using theAt::at()function. It’s a little like Rust’s::std::ops::Indextrait, but adapted so that we can return and work with optionals.