current_crate_name

Crates.iocurrent_crate_name
lib.rscurrent_crate_name
version0.1.1
sourcesrc
created_at2022-10-27 00:54:15.089959
updated_at2022-10-27 00:57:42.887673
descriptionA (const) function to get the current crate name
homepage
repositoryhttps://github.com/Gadiguibou/current_crate_name
max_upload_size
id698682
size15,737
Gabriel Lacroix (Gadiguibou)

documentation

https://docs.rs/current_crate_name

README

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");
Commit count: 2

cargo fmt