about summary refs log tree commit diff
path: root/src/libstd/ascii.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-06-30 21:16:32 +0000
committerbors <bors@rust-lang.org>2014-06-30 21:16:32 +0000
commit8bc286f9987963bd40465905a2c89098f0e10601 (patch)
treefd1fa577f243e6ce65ac4fb96a6af872636c45ef /src/libstd/ascii.rs
parenta345c543344b8ff4f3aeecb816856101443bf907 (diff)
parentc3cf3b3fb10754f92c0703062c39726b52726298 (diff)
downloadrust-8bc286f9987963bd40465905a2c89098f0e10601.tar.gz
rust-8bc286f9987963bd40465905a2c89098f0e10601.zip
auto merge of #15238 : aochagavia/rust/json, r=alexcrichton
### Breaking changes:

* **Removed unnecessary `box` from enum variant (`Object(Box<Object>)` becomes `Object(Object)`)**
* **Deprecated `Encoder::str_encode`**

### Other changes:

* Tried to make the code more idiomatic
* Renamed the `wr` field of the `Encoder` and `PrettyEncoder` structs to `writer`
* Replaced some `from_utf8` by `from_utf8_owned` to avoid unnecessary allocations
* Removed unnecessary `unsafe` code
* Added `encode` and `decode` shortcut functions
* Implemented `FromStr` for `Json`
* Implemented `ToJson` for tuples of arity up to 12
* Fixed some details in the documentation

### Questions

* ~~The `encode` shortcut function does the same as the `Encoder::str_encode` function. It seems wrong to me that two functions do exactly the same. Should we deprecate `Encoder::str_encode`?~~
* ~~Do we really want the ToJson trait for tuples? At the moment we have it for (), (A, B), (A, B, C). I would like to remove them.~~
* ~~We are using `String` as key in the `TreeMap` representing a `Json` object. It would be better to use `&str`, but this would require to annotate lots of lifetimes. Is there any easy solution for this?~~
* There is a lot of duplicated code (`PrettyEncoder` copies about 50 lines from `Encoder`). In an OO language this could be solved very elegantly by using inheritance and overriding. What can we do here to reduce the amount of boilerplate?

[breaking-change]
Diffstat (limited to 'src/libstd/ascii.rs')
0 files changed, 0 insertions, 0 deletions