• Home
  • Raw
  • Download

Lines Matching +full:libclang +full:- +full:version

1 // SPDX-License-Identifier: Apache-2.0
13 fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*
31 fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*
33 link!(@LOAD: #[cfg(feature = "runtime")] fn $name($($pname: $pty), *) $(-> $ret)*);
39 pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;
47 /// The (minimum) version of a `libclang` shared library.
50 pub enum Version {
68 impl fmt::Display for Version {
69 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
70 use Version::*;
82 V9_0 => write!(f, "9.0.x - 10.0.x"),
84 V12_0 => write!(f, "12.0.x - 15.0.x"),
96 pub $name: Option<unsafe extern fn($($pname: $pty), *) $(-> $ret)*>,
100 /// A dynamically loaded instance of the `libclang` library.
109 fn new(library: libloading::Library, path: PathBuf) -> Self {
113 /// Returns the path to this `libclang` shared library.
114 pub fn path(&self) -> &Path {
118 /// Returns the (minimum) version of this `libclang` shared library.
120 /// If this returns `None`, it indicates that the version is too old
122 /// version of this shared library is more recent than that fully
123 /// supported by this crate, the most recent fully supported version
125 pub fn version(&self) -> Option<Version> {
127 ($fn:expr, $version:ident) => {
129 return Some(Version::$version);
158 /// Returns whether a `libclang` shared library is loaded on this thread.
159 pub fn is_loaded() -> bool {
163 fn with_library<T, F>(f: F) -> Option<T> where F: FnOnce(&SharedLibrary) -> T {
173 #[cfg_attr(feature="cargo-clippy", allow(clippy::missing_safety_doc))]
174 #[cfg_attr(feature="cargo-clippy", allow(clippy::too_many_arguments))]
176 pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* {
183 A `libclang` function was called that is not supported by the loaded `libclang` instance.
186 loaded `libclang` instance = {1}
188 This crate only supports `libclang` 3.5 and later.
189 The minimum `libclang` requirement for this particular function can be found here:
190 https://docs.rs/clang-sys/latest/clang_sys/{0}/index.html
192 Instructions for installing `libclang` can be found here:
193 https://rust-lang.github.io/rust-bindgen/requirements.html
197 .version()
199 .unwrap_or_else(|| "unsupported version".into()),
202 }).expect("a `libclang` shared library is not loaded on this thread");
208 pub fn is_loaded() -> bool {
215 $(link!(@LOAD: $(#[cfg($cfg)])* fn $name($($pname: $pty), *) $(-> $ret)*);)+
218 /// Loads a `libclang` shared library and returns the library instance.
225 /// * a `libclang` shared library could not be found
226 /// * the `libclang` shared library could not be opened
227 pub fn load_manually() -> Result<SharedLibrary, String> {
241 "the `libclang` shared library at {} could not be opened: {}",
253 /// Loads a `libclang` shared library for use in the current thread.
262 /// * a `libclang` shared library could not be found
263 /// * the `libclang` shared library could not be opened
265 pub fn load() -> Result<(), String> {
271 /// Unloads the `libclang` shared library in use in the current thread.
275 /// * a `libclang` shared library is not in use in the current thread
276 pub fn unload() -> Result<(), String> {
281 Err("a `libclang` shared library is not in use in the current thread".into())
288 pub fn get_library() -> Option<Arc<SharedLibrary>> {
295 pub fn set_library(library: Option<Arc<SharedLibrary>>) -> Option<Arc<SharedLibrary>> {
306 pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;
312 pub fn $name($($pname: $pty), *) $(-> $ret)*;
319 pub fn is_loaded() -> bool { true }