@@ -214,56 +214,61 @@ pub fn fmt_field(field: &Entity, builder: &Builder) -> Html {
214214 . into ( )
215215}
216216
217- pub fn fmt_fun_decl ( fun : & Entity , builder : & Builder ) -> Html {
217+ fn fmt_fun_signature ( fun : & Entity , builder : & Builder ) -> Html {
218+ HtmlElement :: new ( "summary" )
219+ . with_classes ( & [ "entity" , "fun" ] )
220+ . with_child_opt ( fmt_template_args ( fun, builder) )
221+ . with_child ( HtmlElement :: new ( "span" )
222+ . with_class ( "function-signature" )
223+ . with_child_opt (
224+ fun. is_static_method ( )
225+ . then_some ( Html :: span ( & [ "keyword" , "space-after" ] , "static" ) ) ,
226+ )
227+ . with_child_opt (
228+ fun. is_virtual_method ( )
229+ . then_some ( Html :: span ( & [ "keyword" , "space-after" ] , "virtual" ) ) ,
230+ )
231+ . with_child_opt ( fun. get_result_type ( ) . map ( |t| fmt_type ( & t, builder) ) )
232+ . with_child ( Html :: span (
233+ & [ "name" , "space-before" ] ,
234+ & fun. get_name ( ) . unwrap_or ( "_anon" . into ( ) ) ,
235+ ) )
236+ . with_child (
237+ HtmlElement :: new ( "span" ) . with_class ( "params" ) . with_children (
238+ fun. get_function_arguments ( )
239+ . map ( |args| {
240+ args. iter ( )
241+ . map ( |arg| fmt_param ( arg, builder) )
242+ . collect :: < Vec < _ > > ( )
243+ } )
244+ . unwrap_or ( Vec :: new ( ) )
245+ . insert_between ( || Html :: span ( & [ "comma" , "space-after" ] , "," ) )
246+ . surround ( HtmlText :: new ( "(" ) . into ( ) , HtmlText :: new ( ")" ) . into ( ) ) ,
247+ ) ,
248+ )
249+ . with_child_opt (
250+ fun. is_const_method ( )
251+ . then_some ( Html :: span ( & [ "keyword" , "space-before" ] , "const" ) ) ,
252+ )
253+ . with_child_opt (
254+ fun. is_pure_virtual_method ( ) . then_some :: < Html > (
255+ HtmlList :: new ( vec ! [
256+ Html :: span( & [ "space-before" ] , "=" ) ,
257+ Html :: span( & [ "space-before" , "literal" ] , "0" ) ,
258+ ] )
259+ . into ( ) ,
260+ )
261+ )
262+ )
263+ . into ( )
264+ }
265+
266+ pub fn fmt_class_method ( fun : & Entity , builder : & Builder ) -> Html {
218267 HtmlElement :: new ( "details" )
219268 . with_class ( "entity-desc" )
220269 . with_attr_opt ( "id" , member_fun_link ( fun) )
221270 . with_child (
222- HtmlElement :: new ( "summary" )
223- . with_classes ( & [ "entity" , "fun" ] )
224- . with_child_opt ( fmt_template_args ( fun, builder) )
225- . with_child ( HtmlElement :: new ( "span" )
226- . with_class ( "function-signature" )
227- . with_child_opt (
228- fun. is_static_method ( )
229- . then_some ( Html :: span ( & [ "keyword" , "space-after" ] , "static" ) ) ,
230- )
231- . with_child_opt (
232- fun. is_virtual_method ( )
233- . then_some ( Html :: span ( & [ "keyword" , "space-after" ] , "virtual" ) ) ,
234- )
235- . with_child_opt ( fun. get_result_type ( ) . map ( |t| fmt_type ( & t, builder) ) )
236- . with_child ( Html :: span (
237- & [ "name" , "space-before" ] ,
238- & fun. get_name ( ) . unwrap_or ( "_anon" . into ( ) ) ,
239- ) )
240- . with_child (
241- HtmlElement :: new ( "span" ) . with_class ( "params" ) . with_children (
242- fun. get_function_arguments ( )
243- . map ( |args| {
244- args. iter ( )
245- . map ( |arg| fmt_param ( arg, builder) )
246- . collect :: < Vec < _ > > ( )
247- } )
248- . unwrap_or ( Vec :: new ( ) )
249- . insert_between ( || Html :: span ( & [ "comma" , "space-after" ] , "," ) )
250- . surround ( HtmlText :: new ( "(" ) . into ( ) , HtmlText :: new ( ")" ) . into ( ) ) ,
251- ) ,
252- )
253- . with_child_opt (
254- fun. is_const_method ( )
255- . then_some ( Html :: span ( & [ "keyword" , "space-before" ] , "const" ) ) ,
256- )
257- . with_child_opt (
258- fun. is_pure_virtual_method ( ) . then_some :: < Html > (
259- HtmlList :: new ( vec ! [
260- Html :: span( & [ "space-before" ] , "=" ) ,
261- Html :: span( & [ "space-before" , "literal" ] , "0" ) ,
262- ] )
263- . into ( ) ,
264- )
265- )
266- )
271+ fmt_fun_signature ( fun, builder)
267272 )
268273 . with_child (
269274 HtmlElement :: new ( "div" ) . with_child (
@@ -430,7 +435,7 @@ pub fn output_classlike<'e, T: ASTEntry<'e>>(
430435 "Public static methods" ,
431436 entry. entity( ) . get_member_functions( Access :: Public , Include :: Statics )
432437 . into_iter( )
433- . map( |e| fmt_fun_decl ( & e, builder) )
438+ . map( |e| fmt_class_method ( & e, builder) )
434439 . collect:: <Vec <_>>( ) ,
435440 ) ,
436441 ) ,
@@ -440,7 +445,7 @@ pub fn output_classlike<'e, T: ASTEntry<'e>>(
440445 "Public member functions" ,
441446 entry. entity( ) . get_member_functions( Access :: Public , Include :: Members )
442447 . into_iter( )
443- . map( |e| fmt_fun_decl ( & e, builder) )
448+ . map( |e| fmt_class_method ( & e, builder) )
444449 . collect:: <Vec <_>>( ) ,
445450 ) ,
446451 ) ,
@@ -451,7 +456,7 @@ pub fn output_classlike<'e, T: ASTEntry<'e>>(
451456 "Protected member functions" ,
452457 entry. entity( ) . get_member_functions( Access :: Protected , Include :: Members )
453458 . into_iter( )
454- . map( |e| fmt_fun_decl ( & e, builder) )
459+ . map( |e| fmt_class_method ( & e, builder) )
455460 . collect:: <Vec <_>>( ) ,
456461 ) ,
457462 ) ,
@@ -491,6 +496,20 @@ pub fn output_classlike<'e, T: ASTEntry<'e>>(
491496 ent
492497}
493498
499+ pub fn output_function < ' e , T : ASTEntry < ' e > > (
500+ entry : & T ,
501+ builder : & Builder ,
502+ ) -> Vec < ( & ' static str , Html ) > {
503+ let mut ent = output_entity ( entry, builder) ;
504+ ent. extend ( vec ! [
505+ (
506+ "function_signature" ,
507+ fmt_fun_signature( entry. entity( ) , builder)
508+ )
509+ ] ) ;
510+ ent
511+ }
512+
494513fn fmt_autolinks_recursive < ' a > (
495514 entity : & CppItem ,
496515 config : Arc < Config > ,
0 commit comments