/// Returns the directory and filename of the "best" available `libclang` shared
/// library.
Returns the directory and filename of the "best" available `libclang` shared
library.
Returns the directory and filename of the " best " available ` libclang ` shared library .
pub fn find(runtime: bool) -> Result<(PathBuf, String), String> {
    search_libclang_directories(runtime)?
        .iter()
        // We want to find the `libclang` shared library with the highest
        // version number, hence `max_by_key` below.
        //
        // However, in the case where there are multiple such `libclang` shared
        // libraries, we want to use the order in which they appeared in the
        // list returned by `search_libclang_directories` as a tiebreaker since
        // that function returns `libclang` shared libraries in descending order
        // of preference by how they were found.
        //
        // `max_by_key`, perhaps surprisingly, returns the *last* item with the
        // maximum key rather than the first which results in the opposite of
        // the tiebreaking behavior we want. This is easily fixed by reversing
        // the list first.
        .rev()
        .max_by_key(|f| &f.2)
        .cloned()
        .map(|(path, filename, _)| (path, filename))
        .ok_or_else(|| "unreachable".into())
}
pub fn find ( runtime : bool ) -> Result < ( PathBuf , String ) , String > { search_libclang_directories ( runtime ) ? . iter ( ) // We want to find the `libclang` shared library with the highest // version number, hence `max_by_key` below. // // However, in the case where there are multiple such `libclang` shared // libraries, we want to use the order in which they appeared in the // list returned by `search_libclang_directories` as a tiebreaker since // that function returns `libclang` shared libraries in descending order // of preference by how they were found. // // `max_by_key`, perhaps surprisingly, returns the *last* item with the // maximum key rather than the first which results in the opposite of // the tiebreaking behavior we want. This is easily fixed by reversing // the list first. . rev ( ) . max_by_key ( | f | & f . 2 ) . cloned ( ) . map ( | ( path , filename , _ ) | ( path , filename ) ) . ok_or_else ( | | " " . into ( ) ) }
Returns the directory and filename of the "best" available `libclang` shared
library.
Returns the directory and filename of the " best " available ` libclang ` shared library .
runtime
bool
<not_specific>