@@ -2924,6 +2924,11 @@ ${item.displayPath}<span class="${type}">${name}</span>\
29242924 return functionTypeFingerprint [ ( fullId * 4 ) + 3 ] ;
29252925 }
29262926
2927+ /**
2928+ * Convert raw search index into in-memory search index.
2929+ *
2930+ * @param {[string, RawSearchIndexCrate][] } rawSearchIndex
2931+ */
29272932 function buildIndex ( rawSearchIndex ) {
29282933 searchIndex = [ ] ;
29292934 typeNameIdMap = new Map ( ) ;
@@ -2950,59 +2955,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
29502955 // This loop actually generates the search item indexes, including
29512956 // normalized names, type signature objects and fingerprints, and aliases.
29522957 id = 0 ;
2953- /**
2954- * The raw search data for a given crate. `n`, `t`, `d`, `i`, and `f`
2955- * are arrays with the same length. `q`, `a`, and `c` use a sparse
2956- * representation for compactness.
2957- *
2958- * `n[i]` contains the name of an item.
2959- *
2960- * `t[i]` contains the type of that item
2961- * (as a string of characters that represent an offset in `itemTypes`).
2962- *
2963- * `d[i]` contains the description of that item.
2964- *
2965- * `q` contains the full paths of the items. For compactness, it is a set of
2966- * (index, path) pairs used to create a map. If a given index `i` is
2967- * not present, this indicates "same as the last index present".
2968- *
2969- * `i[i]` contains an item's parent, usually a module. For compactness,
2970- * it is a set of indexes into the `p` array.
2971- *
2972- * `f[i]` contains function signatures, or `0` if the item isn't a function.
2973- * Functions are themselves encoded as arrays. The first item is a list of
2974- * types representing the function's inputs, and the second list item is a list
2975- * of types representing the function's output. Tuples are flattened.
2976- * Types are also represented as arrays; the first item is an index into the `p`
2977- * array, while the second is a list of types representing any generic parameters.
2978- *
2979- * b[i] contains an item's impl disambiguator. This is only present if an item
2980- * is defined in an impl block and, the impl block's type has more than one associated
2981- * item with the same name.
2982- *
2983- * `a` defines aliases with an Array of pairs: [name, offset], where `offset`
2984- * points into the n/t/d/q/i/f arrays.
2985- *
2986- * `doc` contains the description of the crate.
2987- *
2988- * `p` is a list of path/type pairs. It is used for parents and function parameters.
2989- *
2990- * `c` is an array of item indices that are deprecated.
2991- *
2992- * @type {{
2993- * doc: string,
2994- * a: Object,
2995- * n: Array<string>,
2996- * t: String,
2997- * d: Array<string>,
2998- * q: Array<[Number, string]>,
2999- * i: Array<Number>,
3000- * f: Array<RawFunctionSearchType>,
3001- * p: Array<Object>,
3002- * b: Array<[Number, String]>,
3003- * c: Array<Number>
3004- * }}
3005- */
2958+
30062959 for ( const [ crate , crateCorpus ] of rawSearchIndex ) {
30072960 // This object should have exactly the same set of fields as the "row"
30082961 // object defined below. Your JavaScript runtime will thank you.
@@ -3039,7 +2992,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
30392992 const itemDescs = crateCorpus . d ;
30402993 // an array of (Number) the parent path index + 1 to `paths`, or 0 if none
30412994 const itemParentIdxs = crateCorpus . i ;
3042- // an array of (Object | null ) the type of the function, if any
2995+ // an array of (Array | 0 ) the type of the function, if any
30432996 const itemFunctionSearchTypes = crateCorpus . f ;
30442997 // an array of (Number) indices for the deprecated items
30452998 const deprecatedItems = new Set ( crateCorpus . c ) ;
0 commit comments