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).
Use the crate::scale
module to encode and decode Value
s to SCALE bytes. In most cases, you’ll
use this module in conjunction with node metadata so that you have access to a type registry and know
which type you’ll want to try and encode or decode your Value
into.
With the serde feature enabled, you can also use the crate::serde
module to convert rust types to
and from Value
s, or serialize/deserialize them to/from other formats like JSON.
Modules
Encoding and decoding SCALE bytes into a
crate::Value
.Serializing and deserializing a
crate::Value
into/from other types via serde.Converting a
crate::Value
to or from strings.Structs
This represents a sequence of boolean values, packed into bits.
Value
holds 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 specific
Variant
.A “primitive” value (this includes strings).
The underlying shape of a given value.
Traits
This trait allows indexing into
Value
s (and options of Value
s)
using the At::at()
function. It’s a little like Rust’s std::ops::Index
trait, but adapted so that we can return and work with optionals.