pub fn match_ty_with_ident(
tcx: TyCtxt<'_>,
def_id: DefId,
type_ident: String,
) -> Option<Ty<'_>>
Expand description
Match a type identifier string to a concrete Rust type
This function attempts to match a given type identifier (e.g., “u32”, “T”, “MyStruct”) to a type in the provided parameter type list. It handles:
- Built-in primitive types (u32, usize, etc.)
- Generic type parameters (T, U, etc.)
- User-defined types found in the parameter list
Arguments:
tcx
: Type context for querying compiler informationtype_ident
: String representing the type identifier to matchparam_ty
: List of parameter types from the function signature
Returns:
Some(Ty)
if a matching type is foundNone
if no match is found