You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2023. It is now read-only.
This issue was labelled with: A-libs in the Rust repository
The Encodable/Decodable interface is designed to avoid having to allocate everything to intermediate buffers, but json is encouraging going via String. serialize::json has the top level encode function returning a String, and all the examples use encode directly, there's no demonstration of the good direct-to-Writer API.
If that is deemed too ugly, I think we should work on fixing the ergonomics of the good version, rather than just leaping straight to the -> String ones (e.g. json::encode(&mut io::stdout(), &x) would be nice, and work with json::encode(&mut some_file, &x), json::encode(&mut some_tcp_stream, &x), etc.).
For decoding the entire source iterator is consumed, everything is converted to Json objects, and then decoded to the final type, dropping the Json objects.
I'm going to close this now that this crate is deprecated in favor of serde. We're discontinuing feature development in rustc-serialize but will still continue to merge bug fixes if they arise.
Tuesday Jul 01, 2014 at 23:58 GMT
For earlier discussion, see rust-lang/rust#15317
This issue was labelled with: A-libs in the Rust repository
The
Encodable
/Decodable
interface is designed to avoid having to allocate everything to intermediate buffers, butjson
is encouraging going viaString
.serialize::json
has the top levelencode
function returning aString
, and all the examples useencode
directly, there's no demonstration of the good direct-to-Writer
API.That is, something like
can be written a little like
If that is deemed too ugly, I think we should work on fixing the ergonomics of the good version, rather than just leaping straight to the
-> String
ones (e.g.json::encode(&mut io::stdout(), &x)
would be nice, and work withjson::encode(&mut some_file, &x)
,json::encode(&mut some_tcp_stream, &x)
, etc.).cc @aturon
The text was updated successfully, but these errors were encountered: