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

pub enum Value {
    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>>,
    },
}

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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=6&zoom=auto,88,264).

Null

See [3.3 null Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=6&zoom=auto,88,139).

Boolean(bool)

See [3.4 false Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=7&zoom=auto,88,694) and [3.5 true Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=7&zoom=auto,88,596).

Integer(i32)

See [3.6 integer Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=7&zoom=auto,88,499).

Double(f64)

See [3.7 double Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=7&zoom=auto,88,321).

String(String)

See [3.8 String Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=7&zoom=auto,88,196).

XmlDocument(String)

See [3.9 XMLDocument Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=8&zoom=auto,88,639).

Date

See [3.10 Date Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=8&zoom=auto,88,316).

Fields of Date

unix_time: Duration

Unix timestamp with milliseconds precision.

Array

See [3.11 Array Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=11&zoom=auto,88,360).

ByteArray(Vec<u8>)

See [3.14 ByteArray Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf#page=11&zoom=auto,88,167).

IntVector

See [3.15 Vector Type] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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] (http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.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.

Methods

impl Value[src]

pub fn read_from<R>(reader: R) -> DecodeResult<Self> where
    R: Read
[src]

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

pub fn write_to<W>(&self, writer: W) -> Result<()> where
    W: Write
[src]

Writes the AMF3 encoded bytes of this value to writer.

pub fn try_as_str(&self) -> Option<&str>[src]

Tries to convert the value as a str reference.

pub fn try_as_f64(&self) -> Option<f64>[src]

Tries to convert the value as a f64.

pub fn try_into_values(self) -> Result<Box<dyn Iterator<Item = Value>>, Self>[src]

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

pub fn try_into_pairs(
    self
) -> Result<Box<dyn Iterator<Item = (String, Value)>>, Self>
[src]

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

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

impl From<Value> for Value[src]

impl PartialEq<Value> for Value[src]

impl PartialOrd<Value> for Value[src]

impl StructuralPartialEq for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl UnwindSafe for Value

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.