pub enum Value {
Show 13 variants Unit, Nat0(u32), Bool(bool), String(Vec<u8>), Char(u8), Int(i64), Float(f64), Option(Option<Box<Value>>), Record(Vec<(String, Value)>), Tuple(Vec<Value>), Sum { name: String, index: u8, value: Box<Value>, }, Polyvar { name: String, tag: u32, value: Box<Value>, }, List(Vec<Value>),
}
Expand description

Recursive enum that can define any BinProt serializable type

Variants

Unit

Unit type

Nat0(u32)

Variable length natural integer

Bool(bool)

Boolean

String(Vec<u8>)

String

Char(u8)

Char

Int(i64)

Variable length integer

Float(f64)

Float

Option(Option<Box<Value>>)

Option

Record(Vec<(String, Value)>)

records/structs

Tuple(Vec<Value>)

Tuples (fixed length list)

Sum

Fields

name: String

summand/variant name

index: u8

summand index

value: Box<Value>

value wrapped by variant

Sum/enum types

Polyvar

Fields

name: String

Polyvar variant name

tag: u32

Polyvar variant tag (e.g. hash)

value: Box<Value>

value wrapped by variant

Polymorphic Variant (Polyvar) types

List(Vec<Value>)

List of types (variable length)

Implementations

Inner reveals an Option variant as a Rust Option type Calling inner on a non-option variant results in a panic

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.