fn scrape_build_config(config: &Config,
                       jobs: Option<u32>,
                       target: Option<String>)
                       -> CargoResult<ops::BuildConfig> {
    let cfg_jobs = match try!(config.get_i64("build.jobs")) {
        Some((n, p)) => {
            if n <= 0 {
                bail!("build.jobs must be positive, but found {} in {:?}", n, p)
            } else if n >= u32::max_value() as i64 {
                bail!("build.jobs is too large: found {} in {:?}", n, p)
            } else {
                Some(n as u32)
            }
        }
        None => None,
    };
    let jobs = jobs.or(cfg_jobs).unwrap_or(::num_cpus::get() as u32);
    let mut base = ops::BuildConfig {
        jobs: jobs,
        requested_target: target.clone(),
        ..Default::default()
    };
    base.host = try!(scrape_target_config(config, &config.rustc_info().host));
    base.target = match target.as_ref() {
        Some(triple) => try!(scrape_target_config(config, &triple)),
        None => base.host.clone(),
    };
    Ok(base)
}
/// Parse all config files to learn about build configuration. Currently
/// configured options are:
///
/// * build.jobs
/// * target.$target.ar
/// * target.$target.linker
/// * target.$target.libfoo.metadata
Parse all config files to learn about build configuration. Currently
configured options are.


Parse all config files to learn about build configuration . Currently configured options are .
fn scrape_build_config(config: &Config,
                       jobs: Option<u32>,
                       target: Option<String>)
                       -> CargoResult<ops::BuildConfig> {
    let cfg_jobs = match try!(config.get_i64("build.jobs")) {
        Some((n, p)) => {
            if n <= 0 {
                bail!("build.jobs must be positive, but found {} in {:?}", n, p)
            } else if n >= u32::max_value() as i64 {
                bail!("build.jobs is too large: found {} in {:?}", n, p)
            } else {
                Some(n as u32)
            }
        }
        None => None,
    };
    let jobs = jobs.or(cfg_jobs).unwrap_or(::num_cpus::get() as u32);
    let mut base = ops::BuildConfig {
        jobs: jobs,
        requested_target: target.clone(),
        ..Default::default()
    };
    base.host = try!(scrape_target_config(config, &config.rustc_info().host));
    base.target = match target.as_ref() {
        Some(triple) => try!(scrape_target_config(config, &triple)),
        None => base.host.clone(),
    };
    Ok(base)
}
fn scrape_build_config ( config : & Config , jobs : Option < u32 > , target : Option < String > ) -> CargoResult < ops :: BuildConfig > { let cfg_jobs = match try ! ( config get_i64 ( " " ) ) { Some ( ( n , p ) ) => { if n <= 0 { bail ! ( " " n p ) } else if n >= u32 :: max_value ( ) as i64 { bail ! ( " " n p ) } else { Some ( n as u32 ) } } None => None , } ; let jobs = jobs . or ( cfg_jobs ) . unwrap_or ( :: num_cpus :: get ( ) as u32 ) ; let mut base = ops :: BuildConfig { jobs : jobs , requested_target : target . clone ( ) , .. Default :: default ( ) } ; base . host = try ! ( scrape_target_config ( config config rustc_info ( ) host ) ) ; base . target = match target . as_ref ( ) { Some ( triple ) => try ! ( scrape_target_config ( config triple ) ) , None => base . host . clone ( ) , } ; Ok ( base ) }
Parse all config files to learn about build configuration.
Parse all config files to learn about build configuration .
config
&Config
jobs
Option<u32>
target
Option<String>
config
&Config
jobs
Option<u32>
target
Option<String>