#message-format #amf #serialization #amf0 #deserialize #adobe #action

rml_amf0

Modules for handling the encoding and decoding of data with Adobe's Action Message Format 0 (AMF0 data format)

5 unstable releases

Uses old Rust 2015

0.3.0 Jan 12, 2022
0.2.0 Dec 2, 2021
0.1.2 Jan 6, 2021
0.1.1 Apr 15, 2018
0.1.0 Apr 15, 2018

#857 in Encoding

Download history 241/week @ 2024-11-15 155/week @ 2024-11-22 142/week @ 2024-11-29 217/week @ 2024-12-06 127/week @ 2024-12-13 18/week @ 2024-12-20 6/week @ 2024-12-27 51/week @ 2025-01-03 66/week @ 2025-01-10 53/week @ 2025-01-17 49/week @ 2025-01-24 47/week @ 2025-01-31 50/week @ 2025-02-07 48/week @ 2025-02-14 67/week @ 2025-02-21 54/week @ 2025-02-28

231 downloads per month
Used in 7 crates (via rml_rtmp)

MIT license

25KB
515 lines

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

Dependencies

~295–770KB
~17K SLoC