Skip to content

Commit 440271a

Browse files
committed
auto merge of #19490 : oli-obk/rust/json_non_string_key_maps, r=alexcrichton
importing object type string key maps is still supported writing them should be explicit, and can be done as follows ```rust let some_tree_map : TreeMap<String, Json> = ...; Json::Object(some_tree_map).to_writer(&mut writer); ``` related to #8335, #9028, #9142
2 parents d10642e + f7d2e9b commit 440271a

File tree

10 files changed

+161
-100
lines changed

10 files changed

+161
-100
lines changed

src/librbml/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,8 @@ pub mod writer {
10551055
self.end_tag()
10561056
}
10571057

1058-
fn emit_map_elt_key<F>(&mut self, _idx: uint, mut f: F) -> EncodeResult where
1059-
F: FnMut(&mut Encoder<'a, W>) -> EncodeResult,
1058+
fn emit_map_elt_key<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
1059+
F: FnOnce(&mut Encoder<'a, W>) -> EncodeResult,
10601060
{
10611061

10621062
try!(self.start_tag(EsMapKey as uint));

src/librustdoc/html/render.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ thread_local!(pub static CURRENT_LOCATION_KEY: RefCell<Vec<String>> =
253253
pub fn run(mut krate: clean::Crate,
254254
external_html: &ExternalHtml,
255255
dst: Path,
256-
passes: HashSet<String>) -> io::IoResult<()> {
256+
passes: HashSet<String>) -> json::EncodeResult {
257257
let mut cx = Context {
258258
dst: dst,
259259
src_root: krate.src.dir_path(),
@@ -1084,7 +1084,7 @@ impl Context {
10841084
/// This currently isn't parallelized, but it'd be pretty easy to add
10851085
/// parallelization to this function.
10861086
fn krate(mut self, mut krate: clean::Crate,
1087-
stability: stability_summary::ModuleSummary) -> io::IoResult<()> {
1087+
stability: stability_summary::ModuleSummary) -> json::EncodeResult {
10881088
let mut item = match krate.module.take() {
10891089
Some(i) => i,
10901090
None => return Ok(())
@@ -1110,9 +1110,10 @@ impl Context {
11101110
};
11111111
let html_dst = &this.dst.join("stability.html");
11121112
let mut html_out = BufferedWriter::new(try!(File::create(html_dst)));
1113-
layout::render(&mut html_out, &this.layout, &page,
1113+
try!(layout::render(&mut html_out, &this.layout, &page,
11141114
&Sidebar{ cx: this, item: &item },
1115-
&stability)
1115+
&stability));
1116+
Ok(())
11161117
}));
11171118

11181119
// render the crate documentation

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn json_input(input: &str) -> Result<Output, String> {
468468
/// Outputs the crate/plugin json as a giant json blob at the specified
469469
/// destination.
470470
fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
471-
dst: Path) -> io::IoResult<()> {
471+
dst: Path) -> json::EncodeResult {
472472
// {
473473
// "schema": version,
474474
// "crate": { parsed crate ... },

0 commit comments

Comments
 (0)