#module #path #attributes #specify #dynamically #macro

macro dynpath

An attribute macro to specify a path to a module dynamically

5 releases

Uses old Rust 2015

0.1.4 Apr 25, 2022
0.1.3 Apr 25, 2022
0.1.2 Apr 25, 2022
0.1.1 Apr 25, 2022
0.1.0 Apr 25, 2022

#21 in #specify

Download history 18/week @ 2024-02-25 1/week @ 2024-03-03 77/week @ 2024-03-31

77 downloads per month

MIT/Apache

7KB
50 lines

dynpath

Documentation

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

// Turns into `#[path = "whatever/is/in/OUT_DIR/bindings.rs"]`.
#[dynpath("OUT_DIR")]
mod bindings;

License

This project is licensed under either of

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.

Dependencies

~1.5MB
~33K SLoC