/// If possible, this pushes a global path resolving to `external_def_id` that is visible
/// from at least one local module and returns true. If the crate defining `external_def_id` is
/// declared with an `extern crate`, the path is guarenteed to use the `extern crate`.
If possible, this pushes a global path resolving to `external_def_id` that is visible
from at least one local module and returns true.
If possible this pushes a global path resolving to ` external_def_id ` that is visible from at least one local module and returns true .
pub fn try_push_visible_item_path<T>(self, buffer: &mut T, external_def_id: DefId) -> bool
        where T: ItemPathBuffer
    {
        let visible_parent_map = self.sess.cstore.visible_parent_map();
        let (mut cur_def, mut cur_path) = (external_def_id, Vec::<ast::Name>::new());
        loop {
            // If `cur_def` is a direct or injected extern crate, push the path to the crate
            // followed by the path to the item within the crate and return.
            if cur_def.index == CRATE_DEF_INDEX {
                match self.sess.cstore.extern_crate(cur_def.krate) {
                    Some(extern_crate) if extern_crate.direct => {
                        self.push_item_path(buffer, extern_crate.def_id);
                        cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
                        return true;
                    }
                    None => {
                        buffer.push(&self.crate_name(cur_def.krate));
                        cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
                        return true;
                    }
                    _ => {},
                }
            }
            cur_path.push(self.sess.cstore.opt_item_name(cur_def).unwrap_or_else(||
                token::intern("<unnamed>")));
            match visible_parent_map.get(&cur_def) {
                Some(&def) => cur_def = def,
                None => return false,
            };
        }
    }
pub fn try_push_visible_item_path < T > ( self , buffer : & mut T , external_def_id : DefId ) -> bool where T : ItemPathBuffer { let visible_parent_map = self . sess . cstore . visible_parent_map ( ) ; let ( mut cur_def , mut cur_path ) = ( external_def_id , Vec :: < ast :: Name > :: new ( ) ) ; loop { // If `cur_def` is a direct or injected extern crate, push the path to the crate // followed by the path to the item within the crate and return. if cur_def . index == CRATE_DEF_INDEX { match self . sess . cstore . extern_crate ( cur_def . krate ) { Some ( extern_crate ) if extern_crate . direct => { self . push_item_path ( buffer , extern_crate . def_id ) ; cur_path . iter ( ) . rev ( ) . map ( | segment | buffer . push ( & segment . as_str ( ) ) ) . count ( ) ; return true ; } None => { buffer . push ( & self . crate_name ( cur_def . krate ) ) ; cur_path . iter ( ) . rev ( ) . map ( | segment | buffer . push ( & segment . as_str ( ) ) ) . count ( ) ; return true ; } _ => { } , } } cur_path . push ( self . sess . cstore . opt_item_name ( cur_def ) . unwrap_or_else ( | | token :: intern ( " " ) ) ) ; match visible_parent_map . get ( & cur_def ) { Some ( & def ) => cur_def = def , None => return false , } ; } }
If possible, this pushes a global path resolving to `external_def_id` that is visible
from at least one local module and returns true.
If possible this pushes a global path resolving to ` external_def_id ` that is visible from at least one local module and returns true .
self
buffer
&mut T
external_def_id
DefId