@@ -30,11 +30,22 @@ pub trait StructuredParameters: Sized {
3030 name : & str ,
3131 default : Option < T > ,
3232 description : impl Into < std:: sync:: Arc < str > > ,
33+ constraints : impl Into < std:: sync:: Arc < str > > ,
34+ ignore_override : bool ,
35+ discard_mismatching_prior_value : bool ,
3336 ) -> core:: result:: Result < Self , crate :: DeclarationError >
3437 where
3538 Self : StructuredParametersMeta < T > ,
3639 {
37- Self :: declare_structured_ ( node, name, default, description)
40+ Self :: declare_structured_ (
41+ node,
42+ name,
43+ default,
44+ description,
45+ constraints,
46+ ignore_override,
47+ discard_mismatching_prior_value,
48+ )
3849 }
3950}
4051
@@ -56,6 +67,9 @@ pub trait StructuredParametersMeta<T>: Sized {
5667 name : & str ,
5768 default : Option < T > ,
5869 description : impl Into < std:: sync:: Arc < str > > ,
70+ constraints : impl Into < std:: sync:: Arc < str > > ,
71+ ignore_override : bool ,
72+ discard_mismatching_prior_value : bool ,
5973 ) -> core:: result:: Result < Self , crate :: DeclarationError > ;
6074}
6175
@@ -69,7 +83,7 @@ impl NodeState {
6983 where
7084 T : StructuredParameters + StructuredParametersMeta < T0 > ,
7185 {
72- T :: declare_structured ( self , name, None , "" )
86+ T :: declare_structured ( self , name, None , "" , "" , false , false )
7387 }
7488}
7589
@@ -80,13 +94,27 @@ impl<T: crate::ParameterVariant> StructuredParametersMeta<T> for crate::Mandator
8094 name : & str ,
8195 default : Option < T > ,
8296 description : impl Into < std:: sync:: Arc < str > > ,
97+ constraints : impl Into < std:: sync:: Arc < str > > ,
98+ ignore_override : bool ,
99+ discard_mismatching_prior_value : bool ,
83100 ) -> core:: result:: Result < Self , crate :: DeclarationError > {
84101 let builder = node. declare_parameter ( name) ;
85102 let builder = match default {
86103 Some ( default) => builder. default ( default) ,
87104 None => builder,
88105 } ;
89- builder. description ( description) . mandatory ( )
106+ let builder = match ignore_override {
107+ true => builder. ignore_override ( ) ,
108+ false => builder,
109+ } ;
110+ let builder = match discard_mismatching_prior_value {
111+ true => builder. discard_mismatching_prior_value ( ) ,
112+ false => builder,
113+ } ;
114+ builder
115+ . description ( description)
116+ . constraints ( constraints)
117+ . mandatory ( )
90118 }
91119}
92120impl < T : crate :: ParameterVariant > StructuredParameters for crate :: ReadOnlyParameter < T > { }
@@ -96,13 +124,27 @@ impl<T: crate::ParameterVariant> StructuredParametersMeta<T> for crate::ReadOnly
96124 name : & str ,
97125 default : Option < T > ,
98126 description : impl Into < std:: sync:: Arc < str > > ,
127+ constraints : impl Into < std:: sync:: Arc < str > > ,
128+ ignore_override : bool ,
129+ discard_mismatching_prior_value : bool ,
99130 ) -> core:: result:: Result < Self , crate :: DeclarationError > {
100131 let builder = node. declare_parameter ( name) ;
101132 let builder = match default {
102133 Some ( default) => builder. default ( default) ,
103134 None => builder,
104135 } ;
105- builder. description ( description) . read_only ( )
136+ let builder = match ignore_override {
137+ true => builder. ignore_override ( ) ,
138+ false => builder,
139+ } ;
140+ let builder = match discard_mismatching_prior_value {
141+ true => builder. discard_mismatching_prior_value ( ) ,
142+ false => builder,
143+ } ;
144+ builder
145+ . description ( description)
146+ . constraints ( constraints)
147+ . read_only ( )
106148 }
107149}
108150impl < T : crate :: ParameterVariant > StructuredParameters for crate :: OptionalParameter < T > { }
@@ -112,13 +154,31 @@ impl<T: crate::ParameterVariant> StructuredParametersMeta<T> for crate::Optional
112154 name : & str ,
113155 default : Option < T > ,
114156 description : impl Into < std:: sync:: Arc < str > > ,
157+ constraints : impl Into < std:: sync:: Arc < str > > ,
158+ ignore_override : bool ,
159+ discard_mismatching_prior_value : bool ,
115160 ) -> core:: result:: Result < Self , crate :: DeclarationError > {
116161 let builder = node. declare_parameter ( name) ;
117162 let builder = match default {
118163 Some ( default) => builder. default ( default) ,
119164 None => builder,
120165 } ;
121- builder. description ( description) . optional ( )
166+ let builder = match ignore_override {
167+ true => builder. ignore_override ( ) ,
168+ false => builder,
169+ } ;
170+ let builder = match discard_mismatching_prior_value {
171+ true => builder. discard_mismatching_prior_value ( ) ,
172+ false => builder,
173+ } ;
174+
175+ //builder.discriminate(f)
176+ //builder.range(range)
177+
178+ builder
179+ . description ( description)
180+ . constraints ( constraints)
181+ . optional ( )
122182 }
123183}
124184
@@ -216,7 +276,7 @@ mod tests {
216276 }
217277 #[ derive( Debug , StructuredParameters ) ]
218278 struct SimpleStructuredParametersWithDefaultsAndDescriptions {
219- #[ param( default = 42.0 , description = "_mandatory" ) ]
279+ #[ param( default = 42.0 , ignore_override , description = "_mandatory" ) ]
220280 _mandatory : rclrs:: MandatoryParameter < f64 > ,
221281 #[ param( default = 42.0 , description = "_optional" ) ]
222282 _optional : rclrs:: OptionalParameter < f64 > ,
0 commit comments