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,
        time_zone: i16,
    },
    XmlDocument(String),
    AvmPlus(Value),
}
Expand description

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] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=5&zoom=auto,90,667).

Tuple Fields of Number

0: f64
Boolean(bool)

See [2.3 Boolean Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=5&zoom=auto,90,569).

Tuple Fields of Boolean

0: bool
String(String)

See [2.4 String Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=5&zoom=auto,90,432) and [2.14 Long String Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=7&zoom=auto,90,360).

Tuple Fields of String

0: String
Object

See [2.5 Object Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=5&zoom=auto,90,320) and [2.18 Typed Object Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=8&zoom=auto,90,682).

Fields of Object

class_name: Option<String>

The class name of the object. None means it is an anonymous object.

entries: Vec<Pair<String, Value>>

Properties of the object.

Null

See [2.7 null Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=6&zoom=auto,90,720).

Undefined

See [2.8 undefined Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=6&zoom=auto,90,637).

EcmaArray

See [2.10 ECMA Array Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=6&zoom=auto,90,349).

Fields of EcmaArray

entries: Vec<Pair<String, Value>>

Entries of the associative array.

Array

[2.12 Strict Array Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=7&zoom=auto,90,684)

Fields of Array

entries: Vec<Value>

Entries of the array.

Date

See [2.13 Date Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=7&zoom=auto,90,546).

Fields of Date

unix_time: Duration

Unix timestamp with milliseconds precision.

time_zone: i16

Time zone offset.

Note that this is a reserved field and the value should be zero.

XmlDocument(String)

See [2.17 XML Document Type] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=7&zoom=auto,90,147).

Tuple Fields of XmlDocument

0: String
AvmPlus(Value)

See [3.1 AVM+ Type Marker] (http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf#page=8&zoom=auto,90,518).

Tuple Fields of AvmPlus

0: Value

Implementations

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).

Writes the AMF0 encoded bytes of this value to writer.

Tries to convert the value as a str reference.

Tries to convert the value as a f64.

Tries to convert the value as an iterator of the contained values.

Tries to convert the value as an iterator of the contained pairs.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.