The in-place form of encode_named: clear and fill the caller’s buffer,
so a hot loop reuses one allocation across encodes. Bytes identical to
encode_named by construction (it delegates here), so there is still
exactly one encoder.
Parse one frame from the front of buf. Ok(None) means the buffer does
not yet hold a whole frame, so read more bytes. Ok(Some((payload, consumed)))
is one payload and how many bytes of buf it spanned (4 + len). Errors
when the length prefix exceeds MAX_FRAME_BYTES.