Enum amf::amf3::Value[][src]

pub enum Value {
Show 17 variants Undefined, Null, Boolean(bool), Integer(i32), Double(f64), String(String), XmlDocument(String), Date { unix_time: Duration, }, Array { assoc_entries: Vec<Pair<String, Value>>, dense_entries: Vec<Value>, }, Object { class_name: Option<String>, sealed_count: usize, entries: Vec<Pair<String, Value>>, }, Xml(String), ByteArray(Vec<u8>), IntVector { is_fixed: bool, entries: Vec<i32>, }, UintVector { is_fixed: bool, entries: Vec<u32>, }, DoubleVector { is_fixed: bool, entries: Vec<f64>, }, ObjectVector { class_name: Option<String>, is_fixed: bool, entries: Vec<Value>, }, Dictionary { is_weak: bool, entries: Vec<Pair<Value, Value>>, },
}
Expand description

AMF3 value.

Examples

use amf::amf3::Value;

// Encodes a AMF3's integer
let integer = Value::from(Value::Integer(123));
let mut buf = Vec::new();
integer.write_to(&mut buf).unwrap();

// Decodes above integer
let decoded = Value::read_from(&mut &buf[..]).unwrap();
assert_eq!(integer, decoded);

Variants

Undefined

See [3.2 undefined Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=6&zoom=auto,88,264).

Null

See [3.3 null Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=6&zoom=auto,88,139).

Boolean(bool)

See [3.4 false Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=7&zoom=auto,88,694) and [3.5 true Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=7&zoom=auto,88,596).

Tuple Fields of Boolean

0: bool
Integer(i32)

See [3.6 integer Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=7&zoom=auto,88,499).

Tuple Fields of Integer

0: i32
Double(f64)

See [3.7 double Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=7&zoom=auto,88,321).

Tuple Fields of Double

0: f64
String(String)

See [3.8 String Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=7&zoom=auto,88,196).

Tuple Fields of String

0: String
XmlDocument(String)

See [3.9 XMLDocument Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=8&zoom=auto,88,639).

Tuple Fields of XmlDocument

0: String
Date

See [3.10 Date Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=8&zoom=auto,88,316).

Fields of Date

unix_time: Duration

Unix timestamp with milliseconds precision.

Array

See [3.11 Array Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=9&zoom=auto,88,720).

Fields of Array

assoc_entries: Vec<Pair<String, Value>>

Entries of the associative part of the array.

dense_entries: Vec<Value>

Entries of the dense part of the array.

Object

See [3.12 Object Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=9&zoom=auto,88,275).

Fields of Object

class_name: Option<String>

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

sealed_count: usize

Sealed member count of the object.

Sealed members are located in front of the entries.

entries: Vec<Pair<String, Value>>

Members of the object.

Xml(String)

See [3.13 XML Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=11&zoom=auto,88,360).

Tuple Fields of Xml

0: String
ByteArray(Vec<u8>)

See [3.14 ByteArray Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=11&zoom=auto,88,167).

Tuple Fields of ByteArray

0: Vec<u8>
IntVector

See [3.15 Vector Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=12&zoom=auto,88,534).

Fields of IntVector

is_fixed: bool

If true, this is a fixed-length vector.

entries: Vec<i32>

The entries of the vector.

UintVector

See [3.15 Vector Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=12&zoom=auto,88,534).

Fields of UintVector

is_fixed: bool

If true, this is a fixed-length vector.

entries: Vec<u32>

The entries of the vector.

DoubleVector

See [3.15 Vector Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=12&zoom=auto,88,534).

Fields of DoubleVector

is_fixed: bool

If true, this is a fixed-length vector.

entries: Vec<f64>

The entries of the vector.

ObjectVector

See [3.15 Vector Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=12&zoom=auto,88,534).

Fields of ObjectVector

class_name: Option<String>

The base type name of entries in the vector. None means it is the ANY type.

is_fixed: bool

If true, this is a fixed-length vector.

entries: Vec<Value>

The entries of the vector.

Dictionary

See [3.16 Dictionary Type] (https://www.adobe.com/content/dam/acom/en/devnet/pdf/amf-file-format-spec.pdf#page=13&zoom=auto,88,601).

Fields of Dictionary

is_weak: bool

If true, the keys of entries are weakly referenced.

entries: Vec<Pair<Value, Value>>

The entries of the dictionary.

Implementations

Reads an AMF3 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 AMF3 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.