Use impl Trait
return type for next_string_reader
and string_value_writer
#18
Labels
enhancement
New feature or request
Problem solved by the enhancement
Currently
JsonReader::next_string_reader
andJsonWriter::string_value_writer
haveBox<...>
as return type because:JsonReader
andJsonWriter
implementation should be able to implement those methodsHowever, this usage of
Box
means that heap allocations are performed.Enhancement description
Use the
impl Trait
in return positions feature (RFC 3425) once it is available in stable Rust.This allows avoiding usage of
Box
while still addressing the concerns listed above for whyBox
is currently used.A proof-of-concept implementation of this is in https://github.com/Marcono1234/struson/tree/impl-trait-return (has to be slightly adjusted once this Rust feature is part of the stable toolchain).
Alternatives / workarounds
that would however prevent custom
JsonReader
andJsonWriter
implementations from implementing the methods returning these value readers and writersThe text was updated successfully, but these errors were encountered: