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:
DecodeError::UnexpectedEofif the buffer is shorter than the declared length.DecodeError::MessageTooLargeif the declared length overflowsusize.DecodeError::InvalidUtf8if the bytes are not valid UTF-8.