@@ -81,7 +81,6 @@ use crate::html::format::{
8181use crate :: html:: markdown:: {
8282 HeadingOffset , IdMap , Markdown , MarkdownItemInfo , MarkdownSummaryLine , short_markdown_summary,
8383} ;
84- use crate :: html:: render:: search_index:: get_function_type_for_search;
8584use crate :: html:: static_files:: SCRAPE_EXAMPLES_HELP_MD ;
8685use crate :: html:: { highlight, sources} ;
8786use crate :: scrape_examples:: { CallData , CallLocation } ;
@@ -125,63 +124,48 @@ enum RenderMode {
125124// Helper structs for rendering items/sidebars and carrying along contextual
126125// information
127126
128- /// Struct representing one entry in the JS search index. These are all emitted
129- /// by hand to a large JS file at the end of cache-creation.
130127#[ derive( Debug ) ]
131- pub ( crate ) struct IndexItem {
132- pub ( crate ) ty : ItemType ,
133- pub ( crate ) defid : Option < DefId > ,
134- pub ( crate ) name : Symbol ,
135- pub ( crate ) module_path : Vec < Symbol > ,
128+ pub ( crate ) struct IndexItemSubStruct {
136129 pub ( crate ) desc : String ,
137- pub ( crate ) parent : Option < DefId > ,
138- pub ( crate ) parent_idx : Option < usize > ,
139- pub ( crate ) trait_parent : Option < DefId > ,
140- pub ( crate ) trait_parent_idx : Option < usize > ,
141- pub ( crate ) exact_module_path : Option < Vec < Symbol > > ,
142- pub ( crate ) impl_id : Option < DefId > ,
143130 pub ( crate ) search_type : Option < IndexItemFunctionType > ,
144131 pub ( crate ) aliases : Box < [ Symbol ] > ,
145132 pub ( crate ) deprecation : Option < Deprecation > ,
146133}
147134
148- impl IndexItem {
135+ impl IndexItemSubStruct {
149136 pub ( crate ) fn new (
150137 tcx : TyCtxt < ' _ > ,
151138 cache : & Cache ,
152139 item : & Item ,
153- name : Option < Symbol > ,
154- defid : Option < DefId > ,
155- module_path : Vec < Symbol > ,
156140 parent_did : Option < DefId > ,
157- impl_id : Option < DefId > ,
158- trait_parent : Option < DefId > ,
159141 impl_generics : Option < & ( clean:: Type , clean:: Generics ) > ,
160142 ) -> Self {
161143 let desc = short_markdown_summary ( & item. doc_value ( ) , & item. link_names ( cache) ) ;
162- let search_type = get_function_type_for_search ( item, tcx, impl_generics, parent_did, cache) ;
144+ let search_type =
145+ search_index:: get_function_type_for_search ( item, tcx, impl_generics, parent_did, cache) ;
163146 let aliases = item. attrs . get_doc_aliases ( ) ;
164147 let deprecation = item. deprecation ( tcx) ;
165-
166- Self {
167- ty : item. type_ ( ) ,
168- defid : defid. or_else ( || item. item_id . as_def_id ( ) ) ,
169- name : name. or ( item. name ) . unwrap ( ) ,
170- module_path,
171- desc,
172- parent : parent_did,
173- parent_idx : None ,
174- trait_parent,
175- trait_parent_idx : None ,
176- exact_module_path : None ,
177- impl_id,
178- search_type,
179- aliases,
180- deprecation,
181- }
148+ Self { desc, search_type, aliases, deprecation }
182149 }
183150}
184151
152+ /// Struct representing one entry in the JS search index. These are all emitted
153+ /// by hand to a large JS file at the end of cache-creation.
154+ #[ derive( Debug ) ]
155+ pub ( crate ) struct IndexItem {
156+ pub ( crate ) ty : ItemType ,
157+ pub ( crate ) defid : Option < DefId > ,
158+ pub ( crate ) name : Symbol ,
159+ pub ( crate ) module_path : Vec < Symbol > ,
160+ pub ( crate ) parent : Option < DefId > ,
161+ pub ( crate ) parent_idx : Option < usize > ,
162+ pub ( crate ) trait_parent : Option < DefId > ,
163+ pub ( crate ) trait_parent_idx : Option < usize > ,
164+ pub ( crate ) exact_module_path : Option < Vec < Symbol > > ,
165+ pub ( crate ) impl_id : Option < DefId > ,
166+ pub ( crate ) sub_struct : IndexItemSubStruct ,
167+ }
168+
185169/// A type used for the search index.
186170#[ derive( Clone , Debug , Eq , PartialEq ) ]
187171struct RenderType {
0 commit comments