pub enum Value {
VInteger(i64),
VDecimal(f64),
VBoolean(bool),
VString(String),
VSymbol(String),
VTaggedString {
tag: String,
content: String,
},
VArray(Vec<Value>),
VMap(HashMap<String, Value>),
VRange(RangeValue),
VMeasurement {
unit: String,
value: f64,
},
}Expand description
Property value types for Subject properties.
Value is an enum that represents rich value types that can be stored in Subject properties.
It supports standard types (integers, decimals, booleans, strings, symbols) and extended types
(tagged strings, arrays, maps, ranges, measurements).
Note: This type only implements PartialEq, not Eq, because it contains RangeValue
which uses f64 (f64 doesn’t implement Eq due to NaN != NaN).
§Examples
use pattern_core::Value;
// Standard types
let int_val = Value::VInteger(42);
let decimal_val = Value::VDecimal(3.14);
let bool_val = Value::VBoolean(true);
let string_val = Value::VString("hello".to_string());
let symbol_val = Value::VSymbol("sym".to_string());
// Extended types
let tagged = Value::VTaggedString {
tag: "type".to_string(),
content: "value".to_string(),
};
let array = Value::VArray(vec![
Value::VInteger(1),
Value::VInteger(2),
]);Variants§
VInteger(i64)
Integer value (i64)
VDecimal(f64)
Decimal value (f64)
VBoolean(bool)
Boolean value
VString(String)
String value
VSymbol(String)
Symbol value (string identifier)
VTaggedString
Tagged string with a type tag and content
VArray(Vec<Value>)
Array of values
VMap(HashMap<String, Value>)
Map from string keys to values
VRange(RangeValue)
Numeric range value
VMeasurement
Measurement with unit and numeric value (e.g., “5kg” -> unit=“kg”, value=5.0)
Trait Implementations§
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 UnsafeUnpin 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