#protobuf #codec #data #field #fire #format #byte

fire-protobuf

Rust only protobuf implementation

5 releases

0.1.5 Oct 31, 2023
0.1.4 Jul 19, 2023
0.1.2 Jan 20, 2023

#1753 in Encoding

Download history 2/week @ 2024-10-05 7/week @ 2024-10-12 2/week @ 2024-10-19 3/week @ 2024-10-26 7/week @ 2024-11-02 5/week @ 2024-11-16 7/week @ 2024-11-23 5/week @ 2024-11-30 30/week @ 2024-12-07 4/week @ 2024-12-14

52 downloads per month
Used in 5 crates

MIT/Apache

51KB
2K SLoC

Fire Protobuf

A library to encode and decode data in the protobuf format. Supports derive.

Example

use fire_protobuf::{EncodeMessage, DecodeMessage, from_slice, to_vec};

#[derive(Debug, PartialEq, Eq, EncodeMessage, DecodeMessage)]
struct MyData {
	#[field(1)]
	s: String,
	#[field(5)]
	items: Vec<Item>
}

#[derive(Debug, PartialEq, Eq, EncodeMessage, DecodeMessage)]
struct Item {
	#[field(1)]
	name: String,
	#[field(2)]
	value: u32
}

// get the data as bytes
let mut data = MyData {
	s: "data".into(),
	items: vec![
		Item {
			name: "1".into(),
			value: 1
		},
		Item {
			name: "2".into(),
			value: 2
		}
	]
};

let bytes = to_vec(&mut data).unwrap();
let n_data = from_slice(&bytes).unwrap();
assert_eq!(data, n_data);

Dependencies

~3MB
~67K SLoC