AsyncReadExt::read_to_string leaves buf empty if it encounters invalid UTF-8. This is inconsistent with the behavior of std::io::Read::read_to_string, which will truncate it to original length (i.e. leave it unchanged).
Relatedly, the performance of this method could be improved. Currently it validates the entire string; it is only necessary to validate the newly-read portion since the original portion is already guaranteed to be valid.
AsyncReadExt::read_to_string
leavesbuf
empty if it encounters invalid UTF-8. This is inconsistent with the behavior ofstd::io::Read::read_to_string
, which will truncate it to original length (i.e. leave it unchanged).Relatedly, the performance of this method could be improved. Currently it validates the entire string; it is only necessary to validate the newly-read portion since the original portion is already guaranteed to be valid.