sheave_core

Macro object

Source
macro_rules! object {
    ($($key:expr => $value:expr),*) => { ... };
}
Expand description

Constructs an AMF’s Object.

§Examples

use sheave_core::{
    // Note the macro is exported from the top of crate.
    object,
    messages::amf::v0::{
        AmfString,
        Object
    }
};

let mut command_object = Object::default();
command_object.get_properties_mut().insert("app", AmfString::from("ondemand"));
command_object.get_properties_mut().insert("type", AmfString::from("nonprivate"));
command_object.get_properties_mut().insert("flashVer", AmfString::from("FMLE/3.0 (compatible; Lavf 60.10.100)"));
command_object.get_properties_mut().insert("tcUrl", AmfString::from("rtmp://localhost"));
assert_eq!(
    command_object,
    object!(
        "app" => AmfString::from("ondemand"),
        "type" => AmfString::from("nonprivate"),
        "flashVer" => AmfString::from("FMLE/3.0 (compatible; Lavf 60.10.100)"),
        "tcUrl" => AmfString::from("rtmp://localhost")
    )
)