[][src]Function proc_macro_crate::crate_name

pub fn crate_name(orig_name: &'static 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

  • Ok(orig_name) if the crate was found, but not renamed in the Cargo.toml.
  • Ok(RENAMED) if the crate was found, but is renamed in the Cargo.toml. RENAMED will be the renamed name.
  • Err if an error occurred.