serde_bebop

Crates.ioserde_bebop
lib.rsserde_bebop
version0.1.0
sourcesrc
created_at2021-01-15 21:59:39.955897
updated_at2021-01-15 21:59:39.955897
descriptionA Serde implementation for the Bebop protocol
homepage
repositoryhttps://github.com/thomastaylor312/bebop
max_upload_size
id342582
size49,181
Taylor Thomas (thomastaylor312)

documentation

README

Serde Bebop

A Serde implementation of the Bebop protocol. It is purely experimental and I am not yet sure if I will continue maintaining it

What this isn't

To be clear, this is only a serialization and deserialization implementation for Rust, it doesn't have anything else for compiling .bop files or generating code/structs other than the deserialization code

How to use

You'll need the following two imports in your Cargo.toml

[dependencies]
serde_bebop = "0.1"
serde = { version = "1.0", features = ["derive"] }

Then, in your Rust code:

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct Person {
    name: String,
    age: u16,
}

fn main() {
    let data = Person {
        name: "Charlie".to_string(),
        age: 28,
    };

    let raw = serde_bebop::to_bytes(&data).expect("Unable to serialize");
    println!("{:?}", raw);

    let deserialized: Person = serde_bebop::from_bytes(&raw).expect("Unable to deserialize");
    println!("{:?}", deserialized);
}

Missing features

There is currently no support for the GUID and Date types of Bebop as I haven't looked in to how to do that in Serde yet.

Commit count: 0

cargo fmt