fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
               dst: PathBuf) -> io::Result<()> {
    // {
    //   "schema": version,
    //   "crate": { parsed crate ... },
    //   "plugins": { output of plugins ... }
    // }
    let mut json = std::collections::BTreeMap::new();
    json.insert("schema".to_string(), Json::String(SCHEMA_VERSION.to_string()));
    let plugins_json = res.into_iter()
                          .filter_map(|opt| {
                              match opt {
                                  None => None,
                                  Some((string, json)) => {
                                      Some((string.to_string(), json))
                                  }
                              }
                          }).collect();

    // FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode
    // straight to the Rust JSON representation.
    let crate_json_str = format!("{}", json::as_json(&krate));
    let crate_json = match json::from_str(&crate_json_str) {
        Ok(j) => j,
        Err(e) => panic!("Rust generated JSON is invalid: {:?}", e)
    };

    json.insert("crate".to_string(), crate_json);
    json.insert("plugins".to_string(), Json::Object(plugins_json));

    let mut file = try!(File::create(&dst));
    write!(&mut file, "{}", Json::Object(json))
}
/// Outputs the crate/plugin json as a giant json blob at the specified
/// destination.
Outputs the crate/plugin json as a giant json blob at the specified
destination.
Outputs the crate / plugin json as a giant json blob at the specified destination .
fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
               dst: PathBuf) -> io::Result<()> {
    // {
    //   "schema": version,
    //   "crate": { parsed crate ... },
    //   "plugins": { output of plugins ... }
    // }
    let mut json = std::collections::BTreeMap::new();
    json.insert("schema".to_string(), Json::String(SCHEMA_VERSION.to_string()));
    let plugins_json = res.into_iter()
                          .filter_map(|opt| {
                              match opt {
                                  None => None,
                                  Some((string, json)) => {
                                      Some((string.to_string(), json))
                                  }
                              }
                          }).collect();
    // FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode
    // straight to the Rust JSON representation.
    let crate_json_str = format!("{}", json::as_json(&krate));
    let crate_json = match json::from_str(&crate_json_str) {
        Ok(j) => j,
        Err(e) => panic!("Rust generated JSON is invalid: {:?}", e)
    };
    json.insert("crate".to_string(), crate_json);
    json.insert("plugins".to_string(), Json::Object(plugins_json));
    let mut file = try!(File::create(&dst));
    write!(&mut file, "{}", Json::Object(json))
}
fn json_output ( krate : clean :: Crate , res : Vec < plugins :: PluginJson > , dst : PathBuf ) -> io :: Result < ( ) > { // { //   "schema": version, //   "crate": { parsed crate ... }, //   "plugins": { output of plugins ... } // } let mut json = std :: collections :: BTreeMap :: new ( ) ; json . insert ( " " . to_string ( ) , Json :: String ( SCHEMA_VERSION . to_string ( ) ) ) ; let plugins_json = res . into_iter ( ) . filter_map ( | opt | { match opt { None => None , Some ( ( string , json ) ) => { Some ( ( string . to_string ( ) , json ) ) } } } ) . collect ( ) ; // FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode // straight to the Rust JSON representation. let crate_json_str = format ! ( " " json as_json ( krate ) ) ; let crate_json = match json :: from_str ( & crate_json_str ) { Ok ( j ) => j , Err ( e ) => panic ! ( " " e ) } ; json . insert ( " " . to_string ( ) , crate_json ) ; json . insert ( " " . to_string ( ) , Json :: Object ( plugins_json ) ) ; let mut file = try ! ( File create ( dst ) ) ; write ! ( mut file " " Json Object ( json ) ) }
Outputs the crate/plugin json as a giant json blob at the specified
destination.
Outputs the crate / plugin json as a giant json blob at the specified destination .
krate
clean::Crate
res
Vec<plugins::PluginJson>
dst
PathBuf