Crate rml_amf0

Crate rml_amf0 

Source
Expand description

This crate provides functionality for serializing and deserializing data based on the Adobe AMF0 encoding specification located at https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/amf0-file-format-specification.pdf

§Examples

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

Enums§

Amf0DeserializationError
Errors that can occur during the deserialization process
Amf0SerializationError
Errors raised during to the serialization process
Amf0Value
An Enum representing the different supported types of Amf0 values

Functions§

deserialize
Turns any readable byte stream and converts it into an array of AMF0 values
serialize
Serializes values into an amf0 encoded vector of bytes