When StringWriter is a String, provide access to the String.
When ByteWriter is a Vec<u8>, provide access to the Vec<u8>.
This allows converters that write directly to a slice without virtual method calls inside the conversion loop to work without an intermediate copy in the common case (i.e. with the default trait implementations) while not breaking compatibility with custom implementations of the traits. (And by giving access to the whole container object rather than just a slice, this allow the converter to tell the container to grow appropriately.)
(As discussed on IRC many weeks ago.)
When
StringWriter
is aString
, provide access to theString
. WhenByteWriter
is aVec<u8>
, provide access to theVec<u8>
.This allows converters that write directly to a slice without virtual method calls inside the conversion loop to work without an intermediate copy in the common case (i.e. with the default trait implementations) while not breaking compatibility with custom implementations of the traits. (And by giving access to the whole container object rather than just a slice, this allow the converter to tell the container to grow appropriately.)