Enum amf::amf0::Value
[−]
[src]
pub enum Value { Number(f64), Boolean(bool), String(String), Object { class_name: Option<String>, entries: Vec<Pair<String, Value>>, }, Null, Undefined, EcmaArray { entries: Vec<Pair<String, Value>>, }, Array { entries: Vec<Value>, }, Date { unix_time: Duration, }, XmlDocument(String), AvmPlus(Value), }
AMF0 value.
Examples
use amf::amf0::Value; // Encodes a AMF3's number let number = Value::from(Value::Number(12.3)); let mut buf = Vec::new(); number.write_to(&mut buf).unwrap(); // Decodes above number let decoded = Value::read_from(&mut &buf[..]).unwrap(); assert_eq!(number, decoded);
Variants
Number(f64)
See 2.2 Number Type.
Boolean(bool)
See 2.3 Boolean Type.
String(String)
See 2.4 String Type and 2.14 Long String Type.
Object
See 2.5 Object Type and 2.18 Typed Object Type.
Fields
class_name: Option<String> | The class name of the object.
|
entries: Vec<Pair<String, Value>> | Properties of the object. |
Null
See 2.7 null Type.
Undefined
See 2.8 undefined Type.
EcmaArray
See 2.10 ECMA Array Type.
Fields
entries: Vec<Pair<String, Value>> | Entries of the associative array. |
Array
Fields
entries: Vec<Value> | Entries of the array. |
Date
See 2.13 Date Type.
Fields
unix_time: Duration | Unix timestamp with milliseconds precision. |
XmlDocument(String)
AvmPlus(Value)
See 3.1 AVM+ Type Marker.
Methods
impl Value
[src]
fn read_from<R>(reader: R) -> DecodeResult<Self> where R: Read
Reads an AMF0 encoded Value
from reader
.
Note that reference objects are copied in the decoding phase for the sake of simplicity of the resulting value representation. And circular reference are unsupported (i.e., those are treated as errors).
fn write_to<W>(&self, writer: W) -> Result<()> where W: Write
Writes the AMF0 encoded bytes of this value to writer
.
fn try_as_str(&self) -> Option<&str>
Tries to convert the value as a str
reference.
fn try_as_f64(&self) -> Option<f64>
Tries to convert the value as a f64
.
fn try_into_values(self) -> Result<Box<Iterator<Item=Value>>, Self>
Tries to convert the value as an iterator of the contained values.
fn try_into_pairs(self) -> Result<Box<Iterator<Item=(String, Value)>>, Self>
Tries to convert the value as an iterator of the contained pairs.
Trait Implementations
impl Debug for Value
[src]
impl Clone for Value
[src]
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Value
[src]
fn eq(&self, __arg_0: &Value) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Value) -> bool
This method tests for !=
.
impl PartialOrd for Value
[src]
fn partial_cmp(&self, __arg_0: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Value) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Value) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Value) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Value) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more