Skip to main content

decode_string_to

Function decode_string_to 

Source
pub fn decode_string_to<S: ProtoString>(
    buf: &mut impl Buf,
) -> Result<S, DecodeError>
Expand description

Decode a length-delimited string into a configurable ProtoString type.

This is the generic counterpart to decode_string: it reads the varint length prefix, copies that many bytes, and validates UTF-8 identically, then constructs the target representation via From<String>. Generated code uses the in-place merge_string for String fields (which reuses the existing allocation) and this helper for every other ProtoString type.

ยงErrors

Propagates the same errors as decode_string: