/// Look for a plugin registrar. Returns library path and symbol name.
Look for a plugin registrar. Returns library path and symbol name.
Look for a plugin registrar . Returns library path and symbol name .
pub fn find_plugin_registrar(&mut self, span: Span, name: &str)
                                 -> Option<(PathBuf, String)> {
        let ekrate = self.read_extension_crate(span, &CrateInfo {
             name: name.to_string(),
             ident: name.to_string(),
             id: ast::DUMMY_NODE_ID,
             should_link: false,
        });
        if ekrate.target_only {
            // Need to abort before syntax expansion.
            let message = format!("plugin `{}` is not available for triple `{}` \
                                   (only found {})",
                                  name,
                                  config::host_triple(),
                                  self.sess.opts.target_triple);
            self.sess.span_err(span, &message[..]);
            self.sess.abort_if_errors();
        }
        let registrar = decoder::get_plugin_registrar_fn(ekrate.metadata.as_slice())
            .map(|id| decoder::get_symbol_from_buf(ekrate.metadata.as_slice(), id));
        match (ekrate.dylib.as_ref(), registrar) {
            (Some(dylib), Some(reg)) => Some((dylib.to_path_buf(), reg)),
            (None, Some(_)) => {
                let message = format!("plugin `{}` only found in rlib format, \
                                       but must be available in dylib format",
                                       name);
                self.sess.span_err(span, &message[..]);
                // No need to abort because the loading code will just ignore this
                // empty dylib.
                None
            }
            _ => None,
        }
    }
pub fn find_plugin_registrar ( & mut self , span : Span , name : & str ) -> Option < ( PathBuf , String ) > { let ekrate = self . read_extension_crate ( span , & CrateInfo { name : name . to_string ( ) , ident : name . to_string ( ) , id : ast :: DUMMY_NODE_ID , should_link : false , } ) ; if ekrate . target_only { // Need to abort before syntax expansion. let message = format ! ( " \
 " name config host_triple ( ) self sess opts target_triple ) ; self . sess . span_err ( span , & message [ .. ] ) ; self . sess . abort_if_errors ( ) ; } let registrar = decoder :: get_plugin_registrar_fn ( ekrate . metadata . as_slice ( ) ) . map ( | id | decoder :: get_symbol_from_buf ( ekrate . metadata . as_slice ( ) , id ) ) ; match ( ekrate . dylib . as_ref ( ) , registrar ) { ( Some ( dylib ) , Some ( reg ) ) => Some ( ( dylib . to_path_buf ( ) , reg ) ) , ( None , Some ( _ ) ) => { let message = format ! ( " \
 " name ) ; self . sess . span_err ( span , & message [ .. ] ) ; // No need to abort because the loading code will just ignore this // empty dylib. None } _ => None , } }
Look for a plugin registrar.
Look for a plugin registrar .
&mut self
span
Span
name
&str