@@ -2924,6 +2924,11 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2924
2924
return functionTypeFingerprint [ ( fullId * 4 ) + 3 ] ;
2925
2925
}
2926
2926
2927
+ /**
2928
+ * Convert raw search index into in-memory search index.
2929
+ *
2930
+ * @param {[string, RawSearchIndexCrate][] } rawSearchIndex
2931
+ */
2927
2932
function buildIndex ( rawSearchIndex ) {
2928
2933
searchIndex = [ ] ;
2929
2934
typeNameIdMap = new Map ( ) ;
@@ -2950,59 +2955,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2950
2955
// This loop actually generates the search item indexes, including
2951
2956
// normalized names, type signature objects and fingerprints, and aliases.
2952
2957
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
+
3006
2959
for ( const [ crate , crateCorpus ] of rawSearchIndex ) {
3007
2960
// This object should have exactly the same set of fields as the "row"
3008
2961
// object defined below. Your JavaScript runtime will thank you.
@@ -3039,7 +2992,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
3039
2992
const itemDescs = crateCorpus . d ;
3040
2993
// an array of (Number) the parent path index + 1 to `paths`, or 0 if none
3041
2994
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
3043
2996
const itemFunctionSearchTypes = crateCorpus . f ;
3044
2997
// an array of (Number) indices for the deprecated items
3045
2998
const deprecatedItems = new Set ( crateCorpus . c ) ;
0 commit comments