sval_protobuf

Crates.iosval_protobuf
lib.rssval_protobuf
version0.2.2
sourcesrc
created_at2023-10-15 21:29:42.223927
updated_at2024-10-22 12:10:46.478971
descriptionprotobuf encoding for sval
homepage
repositoryhttps://github.com/KodrAus/sval_protobuf
max_upload_size
id1004120
size68,172
Ashley Mannix (KodrAus)

documentation

https://docs.rs/sval_protobuf

README

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.2"

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",
});
Commit count: 49

cargo fmt