Crates.io | current_crate_name |
lib.rs | current_crate_name |
version | 0.1.1 |
source | src |
created_at | 2022-10-27 00:54:15.089959 |
updated_at | 2022-10-27 00:57:42.887673 |
description | A (const) function to get the current crate name |
homepage | |
repository | https://github.com/Gadiguibou/current_crate_name |
max_upload_size | |
id | 698682 |
size | 15,737 |
This library provides, current_crate_name()
, a const function that returns the name of the current crate.
Most other libraries that provide this functionality rely on a macro and\or the CARGO_PKG_NAME
environment
variable. This library relies on the built-in module_path!()
macro instead to provide a simple const fn that
achieves the same result.
use current_crate_name::current_crate_name;
assert_eq!(current_crate_name(), "current_crate_name");