Function rustdoc::html::render::search_index::simplify_fn_type

source ยท
fn simplify_fn_type<'tcx, 'a>(
    self_: Option<&'a Type>,
    generics: &Generics,
    arg: &'a Type,
    tcx: TyCtxt<'tcx>,
    recurse: usize,
    res: &mut Vec<RenderType>,
    rgen: &mut FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)>,
    is_return: bool,
    cache: &Cache,
Expand description

The point of this function is to lower generics and types into the simplified form that the frontend search engine can use.

For example, [T, U, i32]] where you have the bounds: T: Display, U: Option<T> will return [-1, -2, i32] where -1: Display, -2: Option<-1>. If a type parameter has no traid bound, it will still get a number. If a constraint is present but not used in the actual types, it will not be added to the map.

This function also works recursively.