Manipulate paths in Rust macro? -


i want write macro can break apart path manipulate components. example:

macro_rules! example {     ($path:path) => {         vec![             stringify!(get_path_init!($path)),             stringify!(get_path_last!($path)),         ]     }; }  fn main() {     let path_parts = example!(std::vec::vec);     assert_eq!(path_parts, vec!["std::vec", "vec"]); } 

does exist in standard library or reasonably popular crates, , possible implement macros? or require compiler plugin?

it require compiler plugin; cannot done macro_rules!, nor that's part of language or standard library, , crates did (not know of any) require nightly compiler anyway.


Comments