pub enum AmfValue {
Show 13 variants
Null,
Undefined,
Boolean(bool),
Number(f64),
String(String),
Array(Vec<AmfValue>),
Object(HashMap<String, AmfValue>),
TypedObject {
class_name: String,
properties: HashMap<String, AmfValue>,
},
Date(f64),
Xml(String),
ByteArray(Vec<u8>),
Integer(i32),
EcmaArray(HashMap<String, AmfValue>),
}Expand description
Unified AMF value representation
This enum represents all value types supported by AMF0 and AMF3. Some types (like ByteArray, Dictionary) are AMF3-only but included for completeness.
Variants§
Null
Null value (AMF0: 0x05, AMF3: 0x01)
Undefined
Undefined value (AMF0: 0x06, AMF3: 0x00)
Boolean(bool)
Boolean value (AMF0: 0x01, AMF3: 0x02/0x03)
Number(f64)
IEEE 754 double-precision floating point (AMF0: 0x00, AMF3: 0x05)
String(String)
UTF-8 string (AMF0: 0x02, AMF3: 0x06)
Array(Vec<AmfValue>)
Ordered array with optional associative portion In AMF0 this is either StrictArray (0x0A) or ECMAArray (0x08) In AMF3 this is Array (0x09)
Object(HashMap<String, AmfValue>)
Key-value object (AMF0: 0x03, AMF3: 0x0A) Keys are always strings in AMF
TypedObject
Typed object with class name
Date(f64)
Date value as milliseconds since Unix epoch (AMF0: 0x0B, AMF3: 0x08)
Xml(String)
XML document (AMF0: 0x0F, AMF3: 0x07/0x0B)
ByteArray(Vec<u8>)
Raw byte array (AMF3 only: 0x0C)
Integer(i32)
Integer (AMF3 only: 0x04, 29-bit signed)
EcmaArray(HashMap<String, AmfValue>)
ECMA Array - associative array with dense and sparse parts Stored as (dense_length, properties)
Implementations§
Source§impl AmfValue
impl AmfValue
Sourcepub fn as_object(&self) -> Option<&HashMap<String, AmfValue>>
pub fn as_object(&self) -> Option<&HashMap<String, AmfValue>>
Try to get this value as an object reference
Sourcepub fn as_object_mut(&mut self) -> Option<&mut HashMap<String, AmfValue>>
pub fn as_object_mut(&mut self) -> Option<&mut HashMap<String, AmfValue>>
Try to get this value as a mutable object reference
Sourcepub fn is_null_or_undefined(&self) -> bool
pub fn is_null_or_undefined(&self) -> bool
Check if this value is null or undefined
Sourcepub fn get_string(&self, key: &str) -> Option<&str>
pub fn get_string(&self, key: &str) -> Option<&str>
Get a string property from an object value
Sourcepub fn get_number(&self, key: &str) -> Option<f64>
pub fn get_number(&self, key: &str) -> Option<f64>
Get a number property from an object value