@@ -319,16 +319,17 @@ impl<'t> LadFileBuilder<'t> {
319
319
/// ```
320
320
///
321
321
/// And then removes them from the original block, instead putting it in each argument / return docstring
322
- pub fn add_function_info ( & mut self , function_info : FunctionInfo ) -> & mut Self {
322
+ pub fn add_function_info ( & mut self , function_info : & FunctionInfo ) -> & mut Self {
323
323
let default_docstring = Cow :: Owned ( "" . into ( ) ) ;
324
324
let ( main_docstring, arg_docstrings, return_docstring) =
325
325
Self :: split_docstring ( function_info. docs . as_ref ( ) . unwrap_or ( & default_docstring) ) ;
326
326
327
- let function_id = self . lad_function_id_from_info ( & function_info) ;
327
+ let function_id = self . lad_function_id_from_info ( function_info) ;
328
328
let lad_function = LadFunction {
329
- identifier : function_info. name ,
329
+ identifier : function_info. name . clone ( ) ,
330
330
arguments : function_info
331
331
. arg_info
332
+ . clone ( )
332
333
. into_iter ( )
333
334
. map ( |arg| {
334
335
let kind = match & arg. type_info {
@@ -351,6 +352,7 @@ impl<'t> LadFileBuilder<'t> {
351
352
kind : function_info
352
353
. return_info
353
354
. type_info
355
+ . clone ( )
354
356
. map ( |info| self . lad_type_kind_from_through_type ( & info) )
355
357
. unwrap_or_else ( || {
356
358
LadTypeKind :: Unknown (
@@ -1080,9 +1082,9 @@ mod test {
1080
1082
let mut lad_file = LadFileBuilder :: new ( & type_registry)
1081
1083
. set_description ( "## Hello gentlemen\n I am markdown file.\n - hello\n - world" )
1082
1084
. set_sorted ( true )
1083
- . add_function_info ( function_info)
1084
- . add_function_info ( global_function_info)
1085
- . add_function_info ( function_with_complex_args_info)
1085
+ . add_function_info ( & function_info)
1086
+ . add_function_info ( & global_function_info)
1087
+ . add_function_info ( & function_with_complex_args_info)
1086
1088
. add_type :: < StructType < usize > > ( )
1087
1089
. add_type :: < UnitType > ( )
1088
1090
. add_type :: < TupleStructType > ( )
0 commit comments