3 releases

0.1.2 Mar 27, 2024
0.1.1 Jan 22, 2024
0.1.0 Oct 15, 2023

#2086 in Encoding

Apache-2.0 OR MIT

1.5K SLoC


Rust Latest version Documentation Latest

protobuf support for sval.

This library implements a binary encoding for sval::Values that's compatible with the protobuf wire format.

It doesn't require protoc.

Getting started

Add sval_protobuf and sval to your Cargo.toml:

version = "2"

version = "2"

version = "0.1.2"

Derive sval::Value on your types and encode them as protobuf messages:

extern crate sval_derive;

pub struct Record<'a> {
    id: i32,
    title: &'a str,
    data: &'a str,

let encoded = sval_protobuf::stream_to_protobuf(Record {
    id: 42,
    title: "My Message",
    data: "Some extra contents",