Crate prost_helper[][src]

Expand description

A set of prost helper functions to make prost generated code easy to work with.

If you use prost-serde to build your protobuf files, mostly you need this crate to provide functions for is_zero and deserialize_null_default.

You can also use the macros to convert protobuf messages to / try_from Vec<u8>.

For example, if prost generated a data struct Hello, You can use the macros to generate From and /TryFrom respectively, and then use them:

use prost_helper::{prost_into_vec, vec_try_into_prost};
use prost::Message;

#[derive(Clone, PartialEq, prost::Message)]
pub struct Hello {
    #[prost(string, tag = "1")]
    pub msg: String,

prost_into_vec!(Hello, 32);

fn send_hello(data: Vec<u8>) {

let hello = Hello::default();



Generate From and Into for your prost message.

Generate TryFrom and TryInto for your prost message from Vec<u8>.


customized deserialize function to use default for JSON null value.

customized skip_serializing_if function to skip 0 for numbers.