pub trait AsRefExtProtobuf: AsRef<[u8]> {
// Provided method
fn read_protobuf_fields(&self) -> ProtobufFieldSliceIterator<'_> ⓘ { ... }
}Expand description
Extension trait for reading raw Protocol Buffer fields from slice types
This trait provides low-level utilities for reading field-by-field from a byte slice.
It returns borrowed references (Field<&'a [u8]>) suitable for slice sources.
It does not provide semantic interpretation - that is the caller’s responsibility.
§Example
use ::protobuf_core::AsRefExtProtobuf;
let slice = &[0x08, 0x96, 0x01, 0x12, 0x03, 0x48, 0x65, 0x6c][..];
for field_result in slice.read_protobuf_fields() {
let field = field_result?;
// Process field...
}Provided Methods§
Sourcefn read_protobuf_fields(&self) -> ProtobufFieldSliceIterator<'_> ⓘ
fn read_protobuf_fields(&self) -> ProtobufFieldSliceIterator<'_> ⓘ
Read raw protobuf fields from the slice, returning an iterator
This returns an iterator that yields fields sequentially.
Each field contains raw bytes that must be interpreted by the caller.
Returns borrowed references (Field<&'a [u8]>).
This method is available for all types implementing AsRef<[u8]>.