]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/html/static/js/externs.js
Rollup merge of #107706 - tgross35:atomic-as-mut-ptr, r=m-ou-se
[rust.git] / src / librustdoc / html / static / js / externs.js
1 // This file contains type definitions that are processed by the Closure Compiler but are
2 // not put into the JavaScript we include as part of the documentation. It is used for
3 // type checking. See README.md in this directory for more info.
4
5 /* eslint-disable */
6 let searchState;
7 function initSearch(searchIndex){}
8
9 /**
10  * @typedef {{
11  *     name: string,
12  *     fullPath: Array<string>,
13  *     pathWithoutLast: Array<string>,
14  *     pathLast: string,
15  *     generics: Array<QueryElement>,
16  * }}
17  */
18 let QueryElement;
19
20 /**
21  * @typedef {{
22  *      pos: number,
23  *      totalElems: number,
24  *      typeFilter: (null|string),
25  *      userQuery: string,
26  * }}
27  */
28 let ParserState;
29
30 /**
31  * @typedef {{
32  *     original: string,
33  *     userQuery: string,
34  *     typeFilter: number,
35  *     elems: Array<QueryElement>,
36  *     args: Array<QueryElement>,
37  *     returned: Array<QueryElement>,
38  *     foundElems: number,
39  * }}
40  */
41 let ParsedQuery;
42
43 /**
44  * @typedef {{
45  *    crate: string,
46  *    desc: string,
47  *    id: number,
48  *    name: string,
49  *    normalizedName: string,
50  *    parent: (Object|null|undefined),
51  *    path: string,
52  *    ty: (Number|null|number),
53  *    type: (Array<?>|null)
54  * }}
55  */
56 let Row;
57
58 /**
59  * @typedef {{
60  *    in_args: Array<Object>,
61  *    returned: Array<Object>,
62  *    others: Array<Object>,
63  *    query: ParsedQuery,
64  * }}
65  */
66 let ResultsTable;
67
68 /**
69  * @typedef {{
70  *     desc: string,
71  *     displayPath: string,
72  *     fullPath: string,
73  *     href: string,
74  *     id: number,
75  *     lev: number,
76  *     name: string,
77  *     normalizedName: string,
78  *     parent: (Object|undefined),
79  *     path: string,
80  *     ty: number,
81  * }}
82  */
83 let Results;
84
85 /**
86  * A pair of [inputs, outputs], or 0 for null. This is stored in the search index.
87  * The JavaScript deserializes this into FunctionSearchType.
88  *
89  * Numeric IDs are *ONE-indexed* into the paths array (`p`). Zero is used as a sentinel for `null`
90  * because `null` is four bytes while `0` is one byte.
91  *
92  * An input or output can be encoded as just a number if there is only one of them, AND
93  * it has no generics. The no generics rule exists to avoid ambiguity: imagine if you had
94  * a function with a single output, and that output had a single generic:
95  *
96  *     fn something() -> Result<usize, usize>
97  *
98  * If output was allowed to be any RawFunctionType, it would look like this
99  *
100  *     [[], [50, [3, 3]]]
101  *
102  * The problem is that the above output could be interpreted as either a type with ID 50 and two
103  * generics, or it could be interpreted as a pair of types, the first one with ID 50 and the second
104  * with ID 3 and a single generic parameter that is also ID 3. We avoid this ambiguity by choosing
105  * in favor of the pair of types interpretation. This is why the `(number|Array<RawFunctionType>)`
106  * is used instead of `(RawFunctionType|Array<RawFunctionType>)`.
107  *
108  * @typedef {(
109  *     0 |
110  *     [(number|Array<RawFunctionType>)] |
111  *     [(number|Array<RawFunctionType>), (number|Array<RawFunctionType>)]
112  * )}
113  */
114 let RawFunctionSearchType;
115
116 /**
117  * A single function input or output type. This is either a single path ID, or a pair of
118  * [path ID, generics].
119  *
120  * Numeric IDs are *ONE-indexed* into the paths array (`p`). Zero is used as a sentinel for `null`
121  * because `null` is four bytes while `0` is one byte.
122  *
123  * @typedef {number | [number, Array<RawFunctionType>]}
124  */
125 let RawFunctionType;
126
127 /**
128  * @typedef {{
129  *     inputs: Array<FunctionType>,
130  *     outputs: Array<FunctionType>,
131  * }}
132  */
133 let FunctionSearchType;
134
135 /**
136  * @typedef {{
137  *     name: (null|string),
138  *     ty: (null|number),
139  *     generics: Array<FunctionType>,
140  * }}
141  */
142 let FunctionType;