richat_filter/protobuf/
mod.rs1use prost::{
2 bytes::BufMut,
3 encoding::{WireType, encode_key, encode_varint, encoded_len_varint, key_len},
4};
5
6pub mod decode;
7pub mod encode;
8
9#[inline]
10pub fn bytes_encode(tag: u32, value: &[u8], buf: &mut impl BufMut) {
11 encode_key(tag, WireType::LengthDelimited, buf);
12 encode_varint(value.len() as u64, buf);
13 buf.put(value)
14}
15
16#[inline]
17pub const fn bytes_encoded_len(tag: u32, value: &[u8]) -> usize {
18 key_len(tag) + encoded_len_varint(value.len() as u64) + value.len()
19}