Skip to content

Commit

Permalink
Rename to unstable_ir, add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Heesoo Yang committed Oct 30, 2024
1 parent 00df467 commit aede186
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,18 @@ cbindgen = "0.24.0"

If you'd like to use a `build.rs` script with a `cbindgen.toml`, consider using [`cbindgen::generate()`](https://docs.rs/cbindgen/*/cbindgen/fn.generate.html) instead.

## Internal Representation

Some users may find it useful to access the **unstable** internal representation (IR) that cbindgen uses to parse and generate code. By default, the IR is private, but you can access it by enabling the `"unstable_ir"` feature flag like so:

```
[build-dependencies]
cbindgen = { version = "0.27.0", features = ["unstable_ir"] }
```

This opens up the `cbindgen::bindgen::ir` module.

Please remember that the IR is **not stable**, so if you use this feature, you will need to pin cbindgen to avoid breakages.

# Writing Your C API

Expand Down
4 changes: 2 additions & 2 deletions src/bindgen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ mod config;
mod declarationtyperesolver;
mod dependencies;
mod error;
#[cfg(feature = "ir")]
#[cfg(feature = "unstable_ir")]
pub mod ir;
#[cfg(not(feature = "ir"))]
#[cfg(not(feature = "unstable_ir"))]
mod ir;
mod language_backend;
mod library;
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ extern crate quote;
extern crate syn;
extern crate toml;

#[cfg(feature = "ir")]
#[cfg(feature = "unstable_ir")]
pub mod bindgen;
#[cfg(not(feature = "ir"))]
#[cfg(not(feature = "unstable_ir"))]
mod bindgen;

pub use crate::bindgen::*;
Expand Down

0 comments on commit aede186

Please sign in to comment.