1
Fork 0

rustdoc: add support for type filters in arguments and generics

This makes sense, since the search index has the information in it,
and it's more useful for function signature searches since a
function signature search's item type is, by definition, some type
of function (there's more than one, but not very many).
This commit is contained in:
Michael Howell 2023-02-28 18:17:59 -07:00
parent 3ff4d56650
commit e600c0ba0e
15 changed files with 301 additions and 150 deletions

View file

@ -5,6 +5,8 @@ const QUERY = [
'Aaaaaaa -> bool',
'Aaaaaaa -> usize',
'Read -> u64',
'trait:Read -> u64',
'struct:Read -> u64',
'bool -> u64',
'Ddddddd -> u64',
'-> Ddddddd'
@ -36,6 +38,17 @@ const EXPECTED = [
{ 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
],
},
{
// trait:Read -> u64
'others': [
{ 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' },
{ 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
],
},
{
// struct:Read -> u64
'others': [],
},
{
// bool -> u64
'others': [

View file

@ -2,6 +2,8 @@
const QUERY = [
'R<P>',
'R<struct:P>',
'R<enum:P>',
'"P"',
'P',
'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
@ -20,6 +22,20 @@ const EXPECTED = [
{ 'path': 'generics', 'name': 'alpha' },
],
},
{
// R<struct:P>
'returned': [
{ 'path': 'generics', 'name': 'alef' },
],
'in_args': [
{ 'path': 'generics', 'name': 'alpha' },
],
},
{
// R<enum:P>
'returned': [],
'in_args': [],
},
{
// "P"
'others': [

View file

@ -3,6 +3,8 @@
const QUERY = [
"i32",
"str",
"primitive:str",
"struct:str",
"TotoIsSomewhere",
];
@ -17,6 +19,14 @@ const EXPECTED = [
{ 'path': 'primitive', 'name': 'foo' },
],
},
{
'returned': [
{ 'path': 'primitive', 'name': 'foo' },
],
},
{
'returned': [],
},
{
'others': [],
'in_args': [],