use super::{ClassDefinition, Element, ObjectId, Reference};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct ObjectValue {
pub elements: Vec<Element>,
pub class_definition: Option<ClassDefinition>,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct CustomObjectValue {
pub elements: Vec<Element>,
pub dynamic_elements: Vec<Element>,
pub class_definition: ClassDefinition,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct DictionaryObjectValue {
pub elements: Vec<DictionaryEntry>,
pub weak_keys: bool,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct DictionaryEntry {
pub key: Value,
pub value: Value,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct VectorPrimitiveValue<T> {
pub values: Vec<T>,
pub fixed_length: bool,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct VectorObjectValue {
pub values: Vec<Value>,
pub object_type_name: String,
pub fixed_length: bool,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct ECMAArrayObjectValue {
pub dense: Vec<Value>,
pub elements: Vec<Element>,
pub length: u32,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub enum Value {
Number(f64),
Bool(bool),
String(String),
Object {
id: ObjectId,
data: ObjectValue,
},
Null,
Undefined,
ECMAArray {
id: ObjectId,
data: ECMAArrayObjectValue,
},
StrictArray {
id: ObjectId,
values: Vec<Value>,
},
Date {
time: f64,
timezone_or_utc: Option<u16>,
},
Unsupported,
XML {
value: String,
is_string: bool,
},
#[cfg(feature = "amf3")]
AMF3(Box<Value>),
Integer(i32),
ByteArray(Vec<u8>),
VectorInt(VectorPrimitiveValue<i32>),
VectorUInt(VectorPrimitiveValue<u32>),
VectorDouble(VectorPrimitiveValue<f64>),
VectorObject {
id: ObjectId,
data: VectorObjectValue,
},
Dictionary {
id: ObjectId,
data: DictionaryObjectValue,
},
Custom(CustomObjectValue),
Reference(Reference),
Amf3ObjectReference(ObjectId),
}