fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
    let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
    for arg in &matches.opt_strs("extern") {
        let mut parts = arg.splitn(2, '=');
        let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
        let location = parts.next()
                                 .ok_or("--extern value must be of the format `foo=bar`"
                                    .to_string())?;
        let name = name.to_string();
        externs.entry(name).or_default().insert(location.to_string());
    }
    Ok(Externs::new(externs))
}
/// Extracts `--extern CRATE=PATH` arguments from `matches` and
/// returns a map mapping crate names to their paths or else an
/// error message.
Extracts `--extern CRATE=PATH` arguments from `matches` and
returns a map mapping crate names to their paths or else an
error message.
Extracts ` -- extern CRATE = PATH ` arguments from ` matches ` and returns a map mapping crate names to their paths or else an error message .
fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
    let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
    for arg in &matches.opt_strs("extern") {
        let mut parts = arg.splitn(2, '=');
        let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
        let location = parts.next()
                                 .ok_or("--extern value must be of the format `foo=bar`"
                                    .to_string())?;
        let name = name.to_string();
        externs.entry(name).or_default().insert(location.to_string());
    }
    Ok(Externs::new(externs))
}
fn parse_externs ( matches : & getopts :: Matches ) -> Result < Externs , String > { let mut externs : BTreeMap < _ , BTreeSet < _ > > = BTreeMap :: new ( ) ; for arg in & matches . opt_strs ( " " ) { let mut parts = arg . splitn ( 2 , '=' ) ; let name = parts . next ( ) . ok_or ( " " . to_string ( ) ) ? ; let location = parts . next ( ) . ok_or ( " " . to_string ( ) ) ? ; let name = name . to_string ( ) ; externs . entry ( name ) . or_default ( ) . insert ( location . to_string ( ) ) ; } Ok ( Externs :: new ( externs ) ) }
Extracts `--extern CRATE=PATH` arguments from `matches` and
returns a map mapping crate names to their paths or else an
error message.
Extracts ` -- extern CRATE = PATH ` arguments from ` matches ` and returns a map mapping crate names to their paths or else an error message .
matches
&getopts::Matches
matches
&getopts::Matches