Problem solved by the enhancement
As pointed out in this comment on the Rust forum (and subsequent comments) and in this Reddit comment, Struson's API is currently difficult to become familiar with for new users, and relying on panics to enforce correct API usage instead of relying on the compiler is non-idiomatic and error-prone.
Enhancement description
Keep the current JsonReader and JsonWriter API because it is most flexible. But provide additional API which is simpler and more intuitive to use (at the cost of potentially not exposing all JsonReader and JsonWriter features). The new API should be built on top of JsonReader and JsonWriter.
But don't use Drop for implicitly closing arrays or objects (or performing similar fallible actions) because it cannot propagate errors.
Alternatives / workarounds
- Don't add new API but instead adjust
JsonReader and JsonWriter
However, this might prevent using them in some use cases where they can currently be used.
- Don't perform any API changes at all, and if necessary try to adjust the documentation making the intended usage clearer
Problem solved by the enhancement
As pointed out in this comment on the Rust forum (and subsequent comments) and in this Reddit comment, Struson's API is currently difficult to become familiar with for new users, and relying on panics to enforce correct API usage instead of relying on the compiler is non-idiomatic and error-prone.
Enhancement description
Keep the current
JsonReaderandJsonWriterAPI because it is most flexible. But provide additional API which is simpler and more intuitive to use (at the cost of potentially not exposing allJsonReaderandJsonWriterfeatures). The new API should be built on top ofJsonReaderandJsonWriter.But don't use
Dropfor implicitly closing arrays or objects (or performing similar fallible actions) because it cannot propagate errors.Alternatives / workarounds
JsonReaderandJsonWriterHowever, this might prevent using them in some use cases where they can currently be used.