1
Fork 0

Greatly improve generics handling in rustdoc search

This commit is contained in:
Guillaume Gomez 2019-03-07 02:44:28 +01:00
parent 89573b3c8b
commit 64382f4b78
5 changed files with 273 additions and 22 deletions

View file

@ -5025,14 +5025,17 @@ fn make_item_keywords(it: &clean::Item) -> String {
}
fn get_index_search_type(item: &clean::Item) -> Option<IndexItemFunctionType> {
let decl = match item.inner {
clean::FunctionItem(ref f) => &f.decl,
clean::MethodItem(ref m) => &m.decl,
clean::TyMethodItem(ref m) => &m.decl,
let (decl, all_types) = match item.inner {
clean::FunctionItem(ref f) => (&f.decl, &f.all_types),
clean::MethodItem(ref m) => (&m.decl, &m.all_types),
clean::TyMethodItem(ref m) => (&m.decl, &m.all_types),
_ => return None
};
let inputs = decl.inputs.values.iter().map(|arg| get_index_type(&arg.type_)).collect();
println!("====> {:?}", all_types);
let inputs = all_types.iter().map(|arg| {
get_index_type(&arg)
}).collect();
let output = match decl.output {
clean::FunctionRetTy::Return(ref return_type) => Some(get_index_type(return_type)),
_ => None