fn src_href(&self, item: &clean::Item) -> Option<String> {
        let mut root = self.root_path();

        let mut path = String::new();

        // We can safely ignore macros from other libraries
        let file = match item.source.filename {
            FileName::Real(ref path) => path,
            _ => return None,
        };

        let (krate, path) = if item.def_id.is_local() {
            if let Some(path) = self.shared.local_sources.get(file) {
                (&self.shared.layout.krate, path)
            } else {
                return None;
            }
        } else {
            let (krate, src_root) = match *self.cache.extern_locations.get(&item.def_id.krate)? {
                (ref name, ref src, Local) => (name, src),
                (ref name, ref src, Remote(ref s)) => {
                    root = s.to_string();
                    (name, src)
                }
                (_, _, Unknown) => return None,
            };

            sources::clean_path(&src_root, file, false, |component| {
                path.push_str(&component.to_string_lossy());
                path.push('/');
            });
            let mut fname = file.file_name().expect("source has no filename")
                                .to_os_string();
            fname.push(".html");
            path.push_str(&fname.to_string_lossy());
            (krate, &path)
        };

        let lines = if item.source.loline == item.source.hiline {
            item.source.loline.to_string()
        } else {
            format!("{}-{}", item.source.loline, item.source.hiline)
        };
        Some(format!("{root}src/{krate}/{path}#{lines}",
                     root = Escape(&root),
                     krate = krate,
                     path = path,
                     lines = lines))
    }
/// Generates a url appropriate for an `href` attribute back to the source of
/// this item.
///
/// The url generated, when clicked, will redirect the browser back to the
/// original source code.
///
/// If `None` is returned, then a source link couldn't be generated. This
/// may happen, for example, with externally inlined items where the source
/// of their crate documentation isn't known.
Generates a url appropriate for an `href` attribute back to the source of
this item.

The url generated, when clicked, will redirect the browser back to the
original source code.

If `None` is returned, then a source link couldn't be generated. This
may happen, for example, with externally inlined items where the source
of their crate documentation isn't known.
Generates a url appropriate for an ` href ` attribute back to the source of this item . The url generated when clicked will redirect the browser back to the original source code . If ` None ` is returned then a source link couldn ' t be generated . This may happen for example with externally inlined items where the source of their crate documentation isn ' t known .
fn src_href(&self, item: &clean::Item) -> Option<String> {
        let mut root = self.root_path();
        let mut path = String::new();
        // We can safely ignore macros from other libraries
        let file = match item.source.filename {
            FileName::Real(ref path) => path,
            _ => return None,
        };
        let (krate, path) = if item.def_id.is_local() {
            if let Some(path) = self.shared.local_sources.get(file) {
                (&self.shared.layout.krate, path)
            } else {
                return None;
            }
        } else {
            let (krate, src_root) = match *self.cache.extern_locations.get(&item.def_id.krate)? {
                (ref name, ref src, Local) => (name, src),
                (ref name, ref src, Remote(ref s)) => {
                    root = s.to_string();
                    (name, src)
                }
                (_, _, Unknown) => return None,
            };
            sources::clean_path(&src_root, file, false, |component| {
                path.push_str(&component.to_string_lossy());
                path.push('/');
            });
            let mut fname = file.file_name().expect("source has no filename")
                                .to_os_string();
            fname.push(".html");
            path.push_str(&fname.to_string_lossy());
            (krate, &path)
        };
        let lines = if item.source.loline == item.source.hiline {
            item.source.loline.to_string()
        } else {
            format!("{}-{}", item.source.loline, item.source.hiline)
        };
        Some(format!("{root}src/{krate}/{path}#{lines}",
                     root = Escape(&root),
                     krate = krate,
                     path = path,
                     lines = lines))
    }
fn src_href ( & self , item : & clean :: Item ) -> Option < String > { let mut root = self . root_path ( ) ; let mut path = String :: new ( ) ; // We can safely ignore macros from other libraries let file = match item . source . filename { FileName :: Real ( ref path ) => path , _ => return None , } ; let ( krate , path ) = if item . def_id . is_local ( ) { if let Some ( path ) = self . shared . local_sources . get ( file ) { ( & self . shared . layout . krate , path ) } else { return None ; } } else { let ( krate , src_root ) = match * self . cache . extern_locations . get ( & item . def_id . krate ) ? { ( ref name , ref src , Local ) => ( name , src ) , ( ref name , ref src , Remote ( ref s ) ) => { root = s . to_string ( ) ; ( name , src ) } ( _ , _ , Unknown ) => return None , } ; sources :: clean_path ( & src_root , file , false , | component | { path . push_str ( & component . to_string_lossy ( ) ) ; path . push ( '/' ) ; } ) ; let mut fname = file . file_name ( ) . expect ( " " ) . to_os_string ( ) ; fname . push ( " " ) ; path . push_str ( & fname . to_string_lossy ( ) ) ; ( krate , & path ) } ; let lines = if item . source . loline == item . source . hiline { item . source . loline . to_string ( ) } else { format ! ( " " item source loline item source hiline ) } ; Some ( format ! ( " " root Escape ( root ) krate krate path path lines lines ) ) }
Generates a url appropriate for an `href` attribute back to the source of
this item.
Generates a url appropriate for an ` href ` attribute back to the source of this item .
&self
item
&clean::Item
&self
item
&clean::Item