Giter Site home page Giter Site logo

rust-amf0's Introduction

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

Forks from https://github.com/KallDrexx/rust-media-libs

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

rust-amf0's People

Contributors

belltoy avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.