pub enum Value {
Array(Vec<Value>),
String(String),
Integer(i64),
Float(OrderedFloat<f64>),
Boolean(bool),
Map(HashMap<String, Value>),
Null,
TypedError(TypedError),
}Expand description
A generic value type that can represent data from configuration, ALME protocol, WIT interfaces, or other structured sources within the Arcella ecosystem.
This enum serves as a common interchange format for dynamic data, similar to
serde_json::Value but tailored for Arcella’s specific needs.
It supports:
- Primitive types:
String,Integer,Float,Boolean,Null - Compound types:
Array(list ofValue),Map(key-value pairs ofStringtoValue) - Error signaling:
Error(for representing failures during data processing)
§Examples
use arcella_types::config::Value;
use ordered_float::OrderedFloat;
// Creating a simple value
let string_val = Value::String("hello".to_string());
let int_val = Value::Integer(42);
let float_val = Value::Float(OrderedFloat(3.14));
let bool_val = Value::Boolean(true);
let null_val = Value::Null;
// Creating an array of values
let array_val = Value::Array(vec![
Value::String("item1".to_string()),
Value::Integer(2),
Value::Null,
]);
// Creating a map of values
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert("key1".to_string(), Value::Integer(42));
map.insert("key2".to_string(), Value::Boolean(true));
let map_val = Value::Map(map);Variants§
Array(Vec<Value>)
A sequence of Values.
String(String)
A UTF-8 string.
Integer(i64)
A signed 64-bit integer.
Float(OrderedFloat<f64>)
A 64-bit floating-point number.
Uses OrderedFloat to ensure total ordering for use in collections.
Boolean(bool)
A boolean value.
Map(HashMap<String, Value>)
A map of string keys to Values.
Uses HashMap for fast lookups.
Null
An explicit null value, representing the absence of data.
TypedError(TypedError)
A typed error value, useful for signaling errors within data structures.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more