pub(crate) fn crate_prefix() -> StringExpand description
The consuming crate’s name, used as the prefix for every macro-emitted
#[no_mangle] C symbol.
Reads CARGO_CRATE_NAME, which cargo sets (with hyphens already
normalized to underscores) for the rustc invocation that expands this
proc macro — the same precedent miniextendr_init!() relies on
(lib.rs, miniextendr_init fn). Real macro expansion (i.e. compiling a
downstream crate through cargo) always has this set.
Falls back to CARGO_PKG_NAME (normalized the same way, since it is
not auto-normalized) for the one context where CARGO_CRATE_NAME is
absent: this crate’s own unit/insta tests call codegen functions directly
at test runtime rather than through real macro expansion, and cargo
does not forward CARGO_CRATE_NAME to a test binary’s process
environment (verified empirically — only CARGO_PKG_* vars are). Falls
back further to the literal "crate" if even that is absent (e.g. a
direct rustc invocation bypassing cargo entirely).