File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub struct Parameter {
14
14
pub default : Option < Value > ,
15
15
pub modifiers : Vec < Modifier > ,
16
16
pub visibility : Option < VisibilityModifier > ,
17
+ pub variadic : bool ,
17
18
}
18
19
19
20
impl Parameter {
@@ -25,6 +26,7 @@ impl Parameter {
25
26
modifiers : vec ! [ ] ,
26
27
attributes : vec ! [ ] ,
27
28
visibility : None ,
29
+ variadic : false ,
28
30
}
29
31
}
30
32
@@ -40,6 +42,12 @@ impl Parameter {
40
42
self
41
43
}
42
44
45
+ pub fn variadic ( mut self ) -> Self {
46
+ self . variadic = true ;
47
+
48
+ self
49
+ }
50
+
43
51
pub fn default < T : Into < Value > > ( mut self , default : T ) -> Self {
44
52
self . default = Some ( default. into ( ) ) ;
45
53
@@ -109,6 +117,10 @@ impl Generator for Parameter {
109
117
code. push_str ( & format ! ( "{} " , data_type. generate( indentation, level) ) ) ;
110
118
}
111
119
120
+ if self . variadic {
121
+ code. push_str ( "..." ) ;
122
+ }
123
+
112
124
code. push_str ( & format ! ( "${}" , & self . name) ) ;
113
125
114
126
if let Some ( default) = & self . default {
You can’t perform that action at this time.
0 commit comments