Closed nascent-harry closed 1 year ago
Hm, that doesn't seem great. Thanks for the report; I'll look into it.
The issue is that the third write() call isn't consuming all of the input, which is per the spec. It only consumes the first two bytes. If you call write() again with the remaining un-used input, all is well: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a0770eb15be84f64778143d78e8b500a. I'll also add a test to ensure this works.
The problem
From the docs it seems like using
EncoderStringWriter::write
incrementally andEncoderStringWriter::write_all
once should produce the same result.This is not the case as seen in the following example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5ec7ce07f0bd526e7cb8272134eff351