#root #absolute #path #macro #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

#36 in #absolute

Download history 68/week @ 2024-11-16 147/week @ 2024-11-23 157/week @ 2024-11-30 88/week @ 2024-12-07 160/week @ 2024-12-14 97/week @ 2024-12-21 40/week @ 2024-12-28 226/week @ 2025-01-04 205/week @ 2025-01-11 133/week @ 2025-01-18 125/week @ 2025-01-25 215/week @ 2025-02-01 46/week @ 2025-02-08 56/week @ 2025-02-15 38/week @ 2025-02-22 58/week @ 2025-03-01

207 downloads per month
Used in 3 crates

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

~215–660KB
~15K SLoC