#serialization #protobuf #sval #no-std

no-std sval_protobuf

protobuf encoding for sval

7 releases

0.2.3 Mar 26, 2025
0.2.2 Oct 22, 2024
0.1.2 Mar 27, 2024
0.1.1 Jan 22, 2024
0.1.0 Oct 15, 2023

#1269 in Encoding

Download history 27/week @ 2024-12-28 741/week @ 2025-01-04 287/week @ 2025-01-11 214/week @ 2025-01-18 236/week @ 2025-01-25 301/week @ 2025-02-01 345/week @ 2025-02-08 169/week @ 2025-02-15 353/week @ 2025-02-22 235/week @ 2025-03-01 589/week @ 2025-03-08 353/week @ 2025-03-15 776/week @ 2025-03-22 200/week @ 2025-03-29 144/week @ 2025-04-05

1,728 downloads per month
Used in emit_otlp

Apache-2.0 OR MIT

56KB
1.5K SLoC

sval_protobuf

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:

[dependencies.sval]
version = "2"

[dependencies.sval_derive]
version = "2"

[dependencies.sval_protobuf]
version = "0.2.3"

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

#[macro_use]
extern crate sval_derive;

#[derive(Value)]
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",
});

Dependencies

~170KB