pub enum Value {
}Expand description
A value of any FOM data type; see the module documentation for the mapping.
Variants§
Bool(bool)
HLAboolean.
Integer(i128)
A signed or unsigned integer of up to 64 bits. Numbers outside i64::MIN..=u64::MAX fit no data
type and do not survive JSON.
Float(f64)
A 32-bit or 64-bit floating point number.
Octet(u8)
One uninterpreted octet (HLAoctet, HLAbyte).
Char(char)
One character (HLAASCIIchar, HLAunicodeChar).
String(String)
An array of characters (HLAASCIIstring, HLAunicodeString…).
Bytes(Vec<u8>)
An array of octets (HLAopaqueData, HLAlogicalTime…).
Enum(Box<Enumerator>)
An enumerator of an enumerated data type.
Array(Vec<Value>)
An array of any other element data type.
Record(Vec<(String, Value)>)
A fixed record: its fields by name, in the order of the data type.
Variant(Box<VariantValue>)
A variant record.
Handle(Vec<u8>)
The encoded form of a handle (HLAfederateHandle…), see 12.2.
Raw(Vec<u8>)
The octets of a value whose data type cannot be resolved.
Implementations§
Source§impl Value
impl Value
Sourcepub fn enumerator(name: impl Into<String>) -> Self
pub fn enumerator(name: impl Into<String>) -> Self
An enumerator given by name.
Sourcepub fn enumerator_value(value: impl Into<i128>) -> Self
pub fn enumerator_value(value: impl Into<i128>) -> Self
An enumerator given by number.
Sourcepub fn enumerator_with(name: impl Into<String>, value: impl Into<i128>) -> Self
pub fn enumerator_with(name: impl Into<String>, value: impl Into<i128>) -> Self
An enumerator with name and number, the form decoding produces.
Sourcepub fn array<T: Into<Value>>(items: impl IntoIterator<Item = T>) -> Self
pub fn array<T: Into<Value>>(items: impl IntoIterator<Item = T>) -> Self
An array of the given items.
Sourcepub fn record<N: Into<String>, T: Into<Value>>(
fields: impl IntoIterator<Item = (N, T)>,
) -> Self
pub fn record<N: Into<String>, T: Into<Value>>( fields: impl IntoIterator<Item = (N, T)>, ) -> Self
A record of the given fields.
Sourcepub fn variant(
discriminant: impl Into<Enumerator>,
value: Option<Value>,
) -> Self
pub fn variant( discriminant: impl Into<Enumerator>, value: Option<Value>, ) -> Self
A variant record whose alternative is not named; value is None for a discriminant without
data.
Sourcepub fn variant_named(
discriminant: impl Into<Enumerator>,
alternative: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn variant_named( discriminant: impl Into<Enumerator>, alternative: impl Into<String>, value: impl Into<Value>, ) -> Self
A variant record with a named alternative.
Sourcepub fn as_integer(&self) -> Option<i128>
pub fn as_integer(&self) -> Option<i128>
The number of an Integer, an Octet or an Enum that has one.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Value::as_integer when the number fits an i64.
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Value::as_integer when the number fits a u64.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
The number of a Float, or of an Integer converted to the nearest f64.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
The text of a String, or the name of an Enum that has one.
Sourcepub fn as_enumerator(&self) -> Option<&Enumerator>
pub fn as_enumerator(&self) -> Option<&Enumerator>
The enumerator of an Enum.
Sourcepub fn as_variant(&self) -> Option<&VariantValue>
pub fn as_variant(&self) -> Option<&VariantValue>
The content of a Variant.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for Value
A compact single-line form: {Name: "Joe", Rate: 1.5, Tags: [1, 2], State: Serving(2)}.
impl Display for Value
A compact single-line form: {Name: "Joe", Rate: 1.5, Tags: [1, 2], State: Serving(2)}.
Strings and characters are quoted and escaped, octets are hexadecimal (0x0a0b, handle(0x..),
raw(0x..)), enumerators are Name(number), variant records are Discriminant(number){Alternative: value}.