mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	 e600c0ba0e
			
		
	
	
		e600c0ba0e
		
	
	
	
	
		
			
			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).
		
			
				
	
	
		
			169 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const QUERY = [
 | |
|     'fn:foo',
 | |
|     'enum : foo',
 | |
|     'macro<f>:foo',
 | |
|     'macro!',
 | |
|     'macro:mac!',
 | |
|     'a::mac!',
 | |
|     '-> fn:foo',
 | |
|     '-> fn:foo<fn:bar>',
 | |
|     '-> fn:foo<fn:bar, enum : baz::fuzz>',
 | |
| ];
 | |
| 
 | |
| const PARSED = [
 | |
|     {
 | |
|         elems: [{
 | |
|             name: "foo",
 | |
|             fullPath: ["foo"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "foo",
 | |
|             generics: [],
 | |
|             typeFilter: 5,
 | |
|         }],
 | |
|         foundElems: 1,
 | |
|         original: "fn:foo",
 | |
|         returned: [],
 | |
|         userQuery: "fn:foo",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [{
 | |
|             name: "foo",
 | |
|             fullPath: ["foo"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "foo",
 | |
|             generics: [],
 | |
|             typeFilter: 4,
 | |
|         }],
 | |
|         foundElems: 1,
 | |
|         original: "enum : foo",
 | |
|         returned: [],
 | |
|         userQuery: "enum : foo",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [],
 | |
|         foundElems: 0,
 | |
|         original: "macro<f>:foo",
 | |
|         returned: [],
 | |
|         userQuery: "macro<f>:foo",
 | |
|         error: "Unexpected `<` in type filter",
 | |
|     },
 | |
|     {
 | |
|         elems: [{
 | |
|             name: "macro",
 | |
|             fullPath: ["macro"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "macro",
 | |
|             generics: [],
 | |
|             typeFilter: 14,
 | |
|         }],
 | |
|         foundElems: 1,
 | |
|         original: "macro!",
 | |
|         returned: [],
 | |
|         userQuery: "macro!",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [{
 | |
|             name: "mac",
 | |
|             fullPath: ["mac"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "mac",
 | |
|             generics: [],
 | |
|             typeFilter: 14,
 | |
|         }],
 | |
|         foundElems: 1,
 | |
|         original: "macro:mac!",
 | |
|         returned: [],
 | |
|         userQuery: "macro:mac!",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [{
 | |
|             name: "a::mac",
 | |
|             fullPath: ["a", "mac"],
 | |
|             pathWithoutLast: ["a"],
 | |
|             pathLast: "mac",
 | |
|             generics: [],
 | |
|             typeFilter: 14,
 | |
|         }],
 | |
|         foundElems: 1,
 | |
|         original: "a::mac!",
 | |
|         returned: [],
 | |
|         userQuery: "a::mac!",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [],
 | |
|         foundElems: 1,
 | |
|         original: "-> fn:foo",
 | |
|         returned: [{
 | |
|             name: "foo",
 | |
|             fullPath: ["foo"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "foo",
 | |
|             generics: [],
 | |
|             typeFilter: 5,
 | |
|         }],
 | |
|         userQuery: "-> fn:foo",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [],
 | |
|         foundElems: 1,
 | |
|         original: "-> fn:foo<fn:bar>",
 | |
|         returned: [{
 | |
|             name: "foo",
 | |
|             fullPath: ["foo"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "foo",
 | |
|             generics: [
 | |
|                 {
 | |
|                     name: "bar",
 | |
|                     fullPath: ["bar"],
 | |
|                     pathWithoutLast: [],
 | |
|                     pathLast: "bar",
 | |
|                     generics: [],
 | |
|                     typeFilter: 5,
 | |
|                 }
 | |
|             ],
 | |
|             typeFilter: 5,
 | |
|         }],
 | |
|         userQuery: "-> fn:foo<fn:bar>",
 | |
|         error: null,
 | |
|     },
 | |
|     {
 | |
|         elems: [],
 | |
|         foundElems: 1,
 | |
|         original: "-> fn:foo<fn:bar, enum : baz::fuzz>",
 | |
|         returned: [{
 | |
|             name: "foo",
 | |
|             fullPath: ["foo"],
 | |
|             pathWithoutLast: [],
 | |
|             pathLast: "foo",
 | |
|             generics: [
 | |
|                 {
 | |
|                     name: "bar",
 | |
|                     fullPath: ["bar"],
 | |
|                     pathWithoutLast: [],
 | |
|                     pathLast: "bar",
 | |
|                     generics: [],
 | |
|                     typeFilter: 5,
 | |
|                 },
 | |
|                 {
 | |
|                     name: "baz::fuzz",
 | |
|                     fullPath: ["baz", "fuzz"],
 | |
|                     pathWithoutLast: ["baz"],
 | |
|                     pathLast: "fuzz",
 | |
|                     generics: [],
 | |
|                     typeFilter: 4,
 | |
|                 },
 | |
|             ],
 | |
|             typeFilter: 5,
 | |
|         }],
 | |
|         userQuery: "-> fn:foo<fn:bar, enum : baz::fuzz>",
 | |
|         error: null,
 | |
|     },
 | |
| ];
 |