Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
proc_macro_crate::crate_name - Rust
[go: Go Back, main page]

[][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.

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.