rml_amf0

Crates.iorml_amf0
lib.rsrml_amf0
version0.3.0
sourcesrc
created_at2018-04-15 14:44:52.923882
updated_at2022-01-12 22:52:12.053449
descriptionModules for handling the encoding and decoding of data with Adobe's Action Message Format 0 (AMF0 data format).
homepage
repositoryhttps://github.com/KallDrexx/rust-media-libs
max_upload_size
id60756
size25,275
Matthew Shapiro (KallDrexx)

documentation

https://docs.rs/rml_amf0/

README

This crate provides functions for the serialization and deserialization of AMF0 encoded data.

Documentation

https://docs.rs/rml_amf0/

Installation

This crate works with Cargo and is on crates.io. Add it to your Cargo.toml like so:

[dependencies]
rml_amf0 = "0.1"

Example

use std::io::Cursor;
use std::collections::HashMap;
use rml_amf0::{Amf0Value, serialize, deserialize};

// Put some data into the Amf0Value types
let mut properties = HashMap::new();
properties.insert("app".to_string(), Amf0Value::Number(99.0));
properties.insert("second".to_string(), Amf0Value::Utf8String("test".to_string()));

let value1 = Amf0Value::Number(32.0);
let value2 = Amf0Value::Boolean(true);
let object = Amf0Value::Object(properties);

let input = vec![value1, object, value2];

// Serialize the values into a vector of bytes
let serialized_data = serialize(&input).unwrap();

// Deserialize the vector of bytes back into Amf0Value types
let mut serialized_cursor = Cursor::new(serialized_data);
let results = deserialize(&mut serialized_cursor).unwrap();

assert_eq!(input, results);
Commit count: 163

cargo fmt