{"id":21586119,"url":"https://github.com/magiclen/manifest-dir-macros","last_synced_at":"2025-07-11T18:41:10.004Z","repository":{"id":57636566,"uuid":"364433072","full_name":"magiclen/manifest-dir-macros","owner":"magiclen","description":"This crate provides function-like macros to check or operate paths relative to CARGO_MANIFEST_DIR at compile time.","archived":false,"fork":false,"pushed_at":"2023-09-09T05:36:00.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T20:37:57.532Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-05T01:39:09.000Z","updated_at":"2023-08-12T06:21:19.000Z","dependencies_parsed_at":"2024-11-24T15:12:48.275Z","dependency_job_id":null,"html_url":"https://github.com/magiclen/manifest-dir-macros","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"886234c0525691786281de1c1263c809b167c76a"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/magiclen/manifest-dir-macros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fmanifest-dir-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fmanifest-dir-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fmanifest-dir-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fmanifest-dir-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/manifest-dir-macros/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fmanifest-dir-macros/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264874160,"owners_count":23677023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust"],"created_at":"2024-11-24T15:12:43.893Z","updated_at":"2025-07-11T18:41:09.972Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Manifest Dir Macros\n====================\n\n[![CI](https://github.com/magiclen/manifest-dir-macros/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/manifest-dir-macros/actions/workflows/ci.yml)\n\nThis crate provides function-like macros to check or operate paths relative to **CARGO_MANIFEST_DIR** at compile time.\n\n## Examples\n\n```rust\n#[macro_use] extern crate manifest_dir_macros;\n\nprintln!(path!(\"Cargo.toml\"));\nprintln!(path!(\"src/lib.rs\"));\nprintln!(path!(\"src\", \"lib.rs\"));\nprintln!(path!(\"src\", \"lib.rs\", \"/bin\"));\nprintln!(path!(\"/usr\"));\n\nprintln!(exist_path!(\"Cargo.toml\"));\nprintln!(directory_path!(\"src\"));\nprintln!(not_directory_path!(\"Cargo.toml\"));\nprintln!(file_path!(\"Cargo.toml\"));\n\nprintln!(relative_path!(\"Cargo.toml\"));\nprintln!(directory_relative_path!(\"src\"));\nprintln!(not_directory_relative_path!(\"Cargo.toml\"));\nprintln!(file_relative_path!(\"Cargo.toml\"));\n\nprintln!(get_file_name!(\"src/lib.rs\"));\nprintln!(get_file_name!(default = \"main.rs\", \"/\"));\nprintln!(get_file_stem!(\"src/lib.rs\"));\nprintln!(get_file_stem!(default = \"lib\", \"/\"));\nprintln!(get_extension!(\"src/lib.rs\"));\nprintln!(get_extension!(default = \"rs\", \"src/lib\"));\nprintln!(get_parent!(\"src/lib.rs\"));\nprintln!(get_parent!(default = \"/home\", \"/\"));\n\n#[cfg(feature = \"mime_guess\")]\n{\n    println!(mime_guess!(\"src/lib.rs\"));\n    println!(mime_guess!(default = \"application/octet-stream\", \"Cargo.lock\"));\n}\n\n// The `tuple` feature lets these macros above support to input nested literal string tuples, which is useful when you want to use these macros inside a `macro_rule!` macro and concatenate with other literal strings.\n// `$x:expr` matchers can be used in these macros thus.\n#[cfg(feature = \"tuple\")]\n{\n    println!(path!((\"foo\",)));\n    println!(path!((\"foo\", \"bar\")));\n    println!(path!(\"a\", (\"foo\", \"bar\")));\n    println!(path!((\"foo\", \"bar\"), \"a\"));\n    println!(path!((\"foo\", \"bar\"), (\"a\", \"b\")));\n    println!(path!((\"foo\", \"bar\", (\"a\", \"b\")), (\"c\", \"d\")));\n}\n```\n\n## Crates.io\n\nhttps://crates.io/crates/manifest-dir-macros\n\n## Documentation\n\nhttps://docs.rs/manifest-dir-macros\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fmanifest-dir-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Fmanifest-dir-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fmanifest-dir-macros/lists"}