Crates.io | sval_protobuf |
lib.rs | sval_protobuf |
version | |
source | src |
created_at | 2023-10-15 21:29:42.223927+00 |
updated_at | 2025-03-26 23:07:15.004444+00 |
description | protobuf encoding for sval |
homepage | |
repository | https://github.com/KodrAus/sval_protobuf |
max_upload_size | |
id | 1004120 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
sval_protobuf
This library implements a binary encoding for sval::Value
s that's compatible with the
protobuf wire format.
It doesn't require protoc
.
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",
});