marshallpierce / rust-base64

base64, in rust
Apache License 2.0
615 stars 115 forks source link

EncoderWriter: no longer adhere to ‘at most one write’ #220

Open mina86 opened 1 year ago

mina86 commented 1 year ago

The wording around Write::write method is changing with requirement that it maps to ‘at most one write’ being removed¹. With that, change EncoderWriter::write so that it flushes entire output buffer at the beginning and then proceeds to process new input. This eliminates returning Ok(0) which is effectively an error.

Also, change accounting for the occupied portion of the output buffer. Rather than just having occupied length, track occupied range which means moving data to front is no longer necessary.

¹ https://github.com/rust-lang/rust/pull/107200