https://github.com/danakj/dynpath
An attribute macro to specify a path to a module dynamically.
https://github.com/danakj/dynpath
bindgen
Last synced: about 1 year ago
JSON representation
An attribute macro to specify a path to a module dynamically.
- Host: GitHub
- URL: https://github.com/danakj/dynpath
- Owner: danakj
- License: other
- Created: 2022-04-25T04:30:39.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T21:58:25.000Z (almost 4 years ago)
- Last Synced: 2025-04-28T20:06:47.022Z (about 1 year ago)
- Topics: bindgen
- Language: Rust
- Homepage:
- Size: 1.19 MB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# dynpath
[Documentation](https://docs.rs/dynpath)
This crate provides a `#[dynpath()]` macro that can be placed on a `mod`
statement, and which points the module to a dynamic path.
The primary purpose of this crate is to include bindgen-generated bindings
without an `include!()` statement. This allows for code completion and
cross-references.
The macro takes a single parameter which is the name of an environment variable
to read the path from, and it appends the module name and `.rs` extension onto
the contents of the variable.
## Example
```rs
// Turns into `#[path = "whatever/is/in/OUT_DIR/bindings.rs"]`.
#[dynpath("OUT_DIR")]
mod bindings;
```
# License
This project is licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in dynpath by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.