#absolute #root #macro #path #root-directory #project

macro location-macros

Collection of macros for obtaining the absolute path of the project root

3 releases

0.1.2 Mar 21, 2023
0.1.1 Mar 21, 2023
0.1.0 Mar 21, 2023

#1134 in Filesystem

Download history 94/week @ 2024-07-20 149/week @ 2024-07-27 141/week @ 2024-08-03 149/week @ 2024-08-10 99/week @ 2024-08-17 222/week @ 2024-08-24 183/week @ 2024-08-31 145/week @ 2024-09-07 214/week @ 2024-09-14 226/week @ 2024-09-21 118/week @ 2024-09-28 210/week @ 2024-10-05 317/week @ 2024-10-12 132/week @ 2024-10-19 166/week @ 2024-10-26 132/week @ 2024-11-02

798 downloads per month

BSL-1.0 license

7KB
109 lines

location-macros - A collection of macros for obtaining the absolute path of the project root

Examples

  • Get the root directory of the current crate.

    use location_macros::crate_dir;
    
    let crate_dir = crate_dir!();
    println!("The current crate root is {}", crate_dir);
    
  • Get the root directory of the workspace containing current crate.

    use location_macros::workspace_dir;
    
    let workspace_dir = workspace_dir!();
    println!("The current workspace root is {}", workspace_dir);
    

lib.rs:

location-macros

A collection of macros for obtaining the absolute path of the project root.

Dependencies

~270–740KB
~17K SLoC