pub trait IteratorExtProtobuf {
// Required method
fn protobuf_fields(self) -> ProtobufFieldIteratorFromBytes<Self> ⓘ
where Self: Sized;
}Expand description
Extension trait for reading raw Protocol Buffer fields from byte iterators.
This trait provides convenient methods to read fields directly from
any iterator that yields bytes. Returns owned data (Field<Vec<u8>>).
§Example
use ::protobuf_core::IteratorExtProtobuf;
let bytes = vec![0x08, 0x96, 0x01]; // field 1: 150
let iter = bytes.into_iter();
let fields: Vec<_> = iter.protobuf_fields().collect::<::std::result::Result<Vec<_>, _>>().unwrap();
assert_eq!(fields[0].field_number.as_u32(), 1);Required Methods§
Sourcefn protobuf_fields(self) -> ProtobufFieldIteratorFromBytes<Self> ⓘwhere
Self: Sized,
fn protobuf_fields(self) -> ProtobufFieldIteratorFromBytes<Self> ⓘwhere
Self: Sized,
Convert this iterator into an iterator of protobuf fields.
Returns an iterator that yields Result<Field<Vec<u8>>>.
Each field is parsed from the byte stream sequentially.