Protobuf well-known types for buffa.
This crate provides Rust types for Google's well-known .proto types:
- [
google::protobuf::Timestamp] — Unix timestamp with nanosecond precision - [
google::protobuf::Duration] — Signed duration with nanosecond precision - [
google::protobuf::Any] — Any value with an attached type URL - [
google::protobuf::Struct] / [google::protobuf::Value] / [google::protobuf::ListValue] — JSON-like dynamic values - [
google::protobuf::FieldMask] — Specifies a subset of fields referenced in a message - [
google::protobuf::Empty] — A generic empty message - Wrapper types: [
google::protobuf::BoolValue], [google::protobuf::Int32Value], [google::protobuf::Int64Value], [google::protobuf::UInt32Value], [google::protobuf::UInt64Value], [google::protobuf::FloatValue], [google::protobuf::DoubleValue], [google::protobuf::StringValue], [google::protobuf::BytesValue]
Usage
use Timestamp;
use Message;
let ts = Timestamp ;
let bytes = ts.encode_to_vec;
let decoded = decode_from_slice.unwrap;
assert_eq!;
Ergonomic helpers
Common Rust type conversions are provided as trait impls:
Timestamp↔ [std::time::SystemTime] (requiresstdfeature)Duration↔ [std::time::Duration] (requiresstdfeature)Any::pack/Any::unpackhelpersValueconstructors:Value::null,From<f64>,From<String>,From<bool>, etc.- Wrapper type
From/Intoimpls