macro_rules! protobuf_message_decoder {
() => { ... };
($field:tt) => { ... };
($($field:tt),*) => { ... };
}Expand description
Macro for creating an instance of a message decoder.
ยงExamples
use bytecodec::DecodeExt;
use protobuf_codec::field::num::{F1, F2};
use protobuf_codec::scalar::Int32Decoder;
// syntax = "proto3";
//
// message Pair {
// int32 aaa = 1;
// int32 bbb = 2;
// }
let mut decoder = protobuf_message_decoder![
(F1, Int32Decoder::new()),
(F2, Int32Decoder::new(), required)
];
assert_eq!(decoder.decode_from_bytes(&[8, 1, 16, 2][..]).unwrap(), (1, 2));