#path #syn

macro crate-paths-macros

Optional macros library for crate-paths

2 releases

Uses new Rust 2024

0.1.1 Jun 27, 2025
0.1.0 Jun 27, 2025

#107 in #syn


Used in crate-paths

MIT/Apache

5KB

path!(...);

Usage:

path!(std::sync::Arc);

This expands to

#[allow(non_upper_case_globals)]
pub const Arc: crate_paths::Path = {
    #[allow(unused_imports)]
    use std::sync::Arc as _;

    crate_paths::Path::new("std::sync::Arc")
};

path_val!(...);

Usage:

path_val!(std::sync::Arc);

This expands to:

{
  #[allow(unused_imports)]
  use std::sync::Arc as _;

  crate_paths::Path::new("std::sync::Arc")
}

Which you would later assign to a constant:

const SOME_CONSTANT: crate_paths::Path = path_val!("std::sync::Arc");

Dependencies

~0.6–1MB
~22K SLoC