Crate crate_name_utils
source ·Expand description
Utility functions for parsing and processing crate names in symbol strings.
Functions
- Returns the crate name that is derived from a crate object file path.
- Parses the given symbol string to try to find the name of the parent crate that contains the symbol. Depending on the symbol, there may be multiple potential parent crates; if so, they are returned in order of likeliness: the first crate name in the symbol is most likely to contain it. If the parent crate cannot be determined (e.g., a
no_mangle
symbol), then an emptyVec
is returned. - Same as
get_containing_crate_name()
, but returns the substringRange
s of where the parent crate names are located in the givendemangled_full_symbol
string. - Crate names must be only alphanumeric characters, an underscore, or a dash.
- Replaces the
old_crate_name
substring in the givendemangled_full_symbol
with the givennew_crate_name
, if it can be found, and if the parent crate name matches theold_crate_name
. If the parent crate name can be found but does not match the expectedold_crate_name
, then None is returned.