Currently string.encode_wtf8 and string.encode_wtf16 return nothing, effectively relying on the user to have computed a length via string.measure_wtf8 or string.measure_wtf16 beforehand. But they might as well return the encoded length; it's a value that's ready at hand, and there are some cases where you might reserve an ample buffer for encoding but you don't know how many bytes will be written.
Currently
string.encode_wtf8
andstring.encode_wtf16
return nothing, effectively relying on the user to have computed a length viastring.measure_wtf8
orstring.measure_wtf16
beforehand. But they might as well return the encoded length; it's a value that's ready at hand, and there are some cases where you might reserve an ample buffer for encoding but you don't know how many bytes will be written.