Function proc_macro_crate::crate_name[][src]

pub fn crate_name(orig_name: &str) -> Result<String, String>

Find the crate name for the given orig_name in the current Cargo.toml.

orig_name should be the original name of the searched crate.

The current Cargo.toml is determined by taking CARGO_MANIFEST_DIR/Cargo.toml.

Returns

The returned crate name is sanitized in such a way that it is a valid rust identifier. Thus, it is ready to be used in extern crate as identifier.