/// A somewhat inefficient routine to obtain the name of a module.
A somewhat inefficient routine to obtain the name of a module.
A somewhat inefficient routine to obtain the name of a module .
fn module_to_string(module: Module) -> String {
    let mut names = Vec::new();
    fn collect_mod(names: &mut Vec<ast::Name>, module: Module) {
        match module.parent_link {
            NoParentLink => {}
            ModuleParentLink(ref module, name) => {
                names.push(name);
                collect_mod(names, module);
            }
            BlockParentLink(ref module, _) => {
                // danger, shouldn't be ident?
                names.push(token::intern("<opaque>"));
                collect_mod(names, module);
            }
        }
    }
    collect_mod(&mut names, module);
    if names.is_empty() {
        return "???".to_string();
    }
    names_to_string(&names.into_iter().rev().collect::<Vec<ast::Name>>())
}
fn module_to_string ( module : Module ) -> String { let mut names = Vec :: new ( ) ; fn collect_mod ( names : & mut Vec < ast :: Name > , module : Module ) { match module . parent_link { NoParentLink => { } ModuleParentLink ( ref module , name ) => { names . push ( name ) ; collect_mod ( names , module ) ; } BlockParentLink ( ref module , _ ) => { // danger, shouldn't be ident? names . push ( token :: intern ( " " ) ) ; collect_mod ( names , module ) ; } } } collect_mod ( & mut names , module ) ; if names . is_empty ( ) { return " " . to_string ( ) ; } names_to_string ( & names . into_iter ( ) . rev ( ) . collect :: < Vec < ast :: Name > > ( ) ) }
A somewhat inefficient routine to obtain the name of a module.
A somewhat inefficient routine to obtain the name of a module .
module
Module