Skip to main content

Clang

Struct Clang 

Source
pub struct Clang { /* private fields */ }
Expand description

Builder that generates RDL from C/C++ headers using libclang.

Implementations§

Source§

impl Clang

Source

pub fn scrape(&self, plan: &ScrapePlan) -> Summary

Run the plan, replaying this builder once per architecture and merging the results.

Source§

impl Clang

Source

pub fn new() -> Self

Creates a builder with default options.

Source

pub fn input(&mut self, input: impl AsRef<Path>) -> &mut Self

Adds an input header (.h) file or directory.

Source

pub fn inputs<I, S>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<Path>,

Adds input headers.

Source

pub fn input_text(&mut self, input: &str) -> &mut Self

Adds inline source text to compile instead of a file on disk.

Source

pub fn input_texts<I, S>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Adds inline source texts to compile instead of files on disk.

Source

pub fn reference(&mut self, input: impl AsRef<Path>) -> &mut Self

Adds a reference winmd file or directory.

Source

pub fn references<I, S>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<Path>,

Adds multiple reference winmd files or directories.

Source

pub fn reference_bytes(&mut self, input: &[u8]) -> &mut Self

Adds a reference winmd from memory.

Source

pub fn reference_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = B>, B: AsRef<[u8]>,

Adds reference winmds from memory.

Source

pub fn reference_default(&mut self) -> &mut Self

Adds the default Windows metadata as references.

Source

pub fn output(&mut self, output: impl AsRef<Path>) -> &mut Self

Sets the output .rdl file path.

Source

pub fn namespace(&mut self, namespace: &str) -> &mut Self

Sets the namespace for the generated types.

Source

pub fn library(&mut self, library: &str) -> &mut Self

Sets the library name recorded for imported functions.

Source

pub fn drop_lib_less(&mut self) -> &mut Self

Drops functions with no resolved import library; leave off without .lib inputs.

Source

pub fn resolution_input(&mut self, input: impl AsRef<Path>) -> &mut Self

Adds a winmd used only to classify ABI::Windows::* projection declarations.

Source

pub fn resolution_inputs<I, S>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<Path>,

Adds winmds used only to classify ABI::Windows::* projection declarations.

Source

pub fn resolution_bytes(&mut self, input: &[u8]) -> &mut Self

Adds a resolution-only winmd from memory.

Source

pub fn resolution_byte_sets<I, B>(&mut self, inputs: I) -> &mut Self
where I: IntoIterator<Item = B>, B: AsRef<[u8]>,

Adds resolution-only winmds from memory.

Source

pub fn resolution_default(&mut self) -> &mut Self

Adds the default Windows Runtime metadata as a resolution-only input.

Source

pub fn libraries<I, K, V>(&mut self, libraries: I) -> &mut Self
where I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>,

Adds symbol -> DLL overrides for functions.

Prefer per-DLL .lib files over umbrella/apiset libraries for real DLL names.

Source

pub fn resolved_library(&self, symbol: &str) -> Option<&str>

Returns the DLL currently mapped to a function symbol.

Source

pub fn import_library( &mut self, path: impl AsRef<Path>, ) -> Result<&mut Self, Error>

Reads a COFF import library and adds its symbol -> DLL mappings.

Source

pub fn filter(&mut self, filter: &str) -> &mut Self

Adds a normalized header path suffix to the inclusion filter.

Source

pub fn filters<I, S>(&mut self, filters: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Adds multiple header path suffixes to the inclusion filter.

Source

pub fn arg<S: AsRef<str>>(&mut self, arg: S) -> &mut Self

Adds a compiler argument to pass to libclang.

Source

pub fn args<I>(&mut self, args: I) -> &mut Self
where I: IntoIterator, I::Item: AsRef<str>,

Adds multiple compiler arguments to pass to libclang.

Source

pub fn target(&mut self, target: &str) -> &mut Self

Sets the target triple used for all clang invocations.

Source

pub fn scope(&mut self, scope: &str) -> &mut Self

Adds a header directory segment that acts as a root for the reachability sweep.

Source

pub fn scopes<I, S>(&mut self, scopes: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Adds multiple header directory segments as roots for the reachability sweep.

Source

pub fn scope_header(&mut self, header: &str) -> &mut Self

Marks a header as a sweep root regardless of SDK directory.

Source

pub fn scope_headers<I, S>(&mut self, headers: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Marks multiple headers as sweep roots regardless of SDK directory.

Source

pub fn exclude_header(&mut self, header: &str) -> &mut Self

Drops a named header partition before the reachability sweep.

Source

pub fn exclude_headers<I, S>(&mut self, headers: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Drops multiple named header partitions before the reachability sweep.

Source

pub fn symbol(&mut self, symbol: &str) -> &mut Self

Restricts root emission to a named function symbol.

Source

pub fn symbols<I, S>(&mut self, symbols: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

Restricts root emission to the named function symbols.

Source

pub fn version() -> Result<String, Error>

Returns the version string reported by the loaded libclang.

Source

pub fn write(&self) -> Result<(), Error>

Generates the RDL and writes it to the configured output.

Source

pub fn write_by_header(&self) -> Result<(), Error>

Writes one flat-root RDL file per defining header.

Trait Implementations§

Source§

impl Clone for Clang

Source§

fn clone(&self) -> Clang

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Clang

Source§

fn default() -> Clang

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Clang

§

impl RefUnwindSafe for Clang

§

impl Send for Clang

§

impl Sync for Clang

§

impl Unpin for Clang

§

impl UnsafeUnpin for Clang

§

impl UnwindSafe for Clang

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.