#name #crates #current

yanked current_crate_name

A (const) function to get the current crate name

0.1.1 Oct 27, 2022
0.1.0 Oct 27, 2022

#9 in #current

MIT/Apache

7KB

Current crate name

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.

Usage

use current_crate_name::current_crate_name;

assert_eq!(current_crate_name(), "current_crate_name");

lib.rs:

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.

No runtime deps