pub trait Protobuf: Sized {
// Required methods
fn encode(&self) -> Vec<u8> ⓘ;
fn decode(buf: impl Buf) -> Result<Self, DecodeError>;
}
Available on crate feature
protobufs
only.Expand description
Trait allowing serializing and deserializing in protobuf format
Required Methods§
Sourcefn encode(&self) -> Vec<u8> ⓘ
fn encode(&self) -> Vec<u8> ⓘ
Encode into protobuf format. Returns a freshly-allocated buffer containing binary data.
Sourcefn decode(buf: impl Buf) -> Result<Self, DecodeError>
fn decode(buf: impl Buf) -> Result<Self, DecodeError>
Decode the binary data in buf
, producing something of type Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.