@@ -53,6 +53,7 @@ impl FrameConfig {
53
53
pub struct CodeGenConfig {
54
54
pub common : CommonConfig ,
55
55
pub rust : RustConfig ,
56
+ pub smcat : SmcatConfig ,
56
57
}
57
58
58
59
/// Code generation options shared among all backends.
@@ -168,6 +169,34 @@ pub struct RustCode {
168
169
pub state_cell_var_name : String ,
169
170
}
170
171
172
+ /// Code generation options specific to the Smcat backend.
173
+ #[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
174
+ pub struct SmcatConfig {
175
+ pub features : SmcatFeatures ,
176
+ pub code : SmcatCode ,
177
+ }
178
+
179
+ /// Code generation features specific to the Smcat backend.
180
+ #[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
181
+ pub struct SmcatFeatures { }
182
+
183
+ /// Style options for generated code specific to the Smcat backend.
184
+ ///
185
+ /// See the sections "colors and line width", "classes", and "overriding the
186
+ /// type of a state" in the smcat README:
187
+ /// <https://github.com/sverweij/state-machine-cat/blob/develop/README.md>
188
+ #[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
189
+ pub struct SmcatCode {
190
+ /// Style settings for nodes that do not have any children.
191
+ pub simple_state_node_style : String ,
192
+ /// Style settings for nodes that have sub-states as children.
193
+ pub parent_state_node_style : String ,
194
+ /// Style settings for "change-state" transitions.
195
+ pub change_state_edge_style : String ,
196
+ /// Style settings for standard transitions.
197
+ pub transition_edge_style : String ,
198
+ }
199
+
171
200
impl FrameConfig {
172
201
/// Generate a configuration from any `Provider`.
173
202
pub fn from < T : Provider > ( provider : T ) -> Result < FrameConfig , Error > {
@@ -288,24 +317,25 @@ impl Provider for SystemNode {
288
317
// Defaults
289
318
290
319
impl Default for FrameConfig {
291
- fn default ( ) -> FrameConfig {
320
+ fn default ( ) -> Self {
292
321
FrameConfig {
293
322
codegen : CodeGenConfig :: default ( ) ,
294
323
}
295
324
}
296
325
}
297
326
298
327
impl Default for CodeGenConfig {
299
- fn default ( ) -> CodeGenConfig {
328
+ fn default ( ) -> Self {
300
329
CodeGenConfig {
301
330
common : CommonConfig :: default ( ) ,
302
331
rust : RustConfig :: default ( ) ,
332
+ smcat : SmcatConfig :: default ( ) ,
303
333
}
304
334
}
305
335
}
306
336
307
337
impl Default for CommonConfig {
308
- fn default ( ) -> CommonConfig {
338
+ fn default ( ) -> Self {
309
339
CommonConfig {
310
340
features : CommonFeatures :: default ( ) ,
311
341
code : CommonCode :: default ( ) ,
@@ -314,19 +344,19 @@ impl Default for CommonConfig {
314
344
}
315
345
316
346
impl Default for CommonFeatures {
317
- fn default ( ) -> CommonFeatures {
347
+ fn default ( ) -> Self {
318
348
CommonFeatures { }
319
349
}
320
350
}
321
351
322
352
impl Default for CommonCode {
323
- fn default ( ) -> CommonCode {
353
+ fn default ( ) -> Self {
324
354
CommonCode { }
325
355
}
326
356
}
327
357
328
358
impl Default for RustConfig {
329
- fn default ( ) -> RustConfig {
359
+ fn default ( ) -> Self {
330
360
RustConfig {
331
361
features : RustFeatures :: default ( ) ,
332
362
code : RustCode :: default ( ) ,
@@ -335,7 +365,7 @@ impl Default for RustConfig {
335
365
}
336
366
337
367
impl Default for RustFeatures {
338
- fn default ( ) -> RustFeatures {
368
+ fn default ( ) -> Self {
339
369
RustFeatures {
340
370
follow_rust_naming : true ,
341
371
generate_action_impl : true ,
@@ -346,7 +376,7 @@ impl Default for RustFeatures {
346
376
}
347
377
348
378
impl Default for RustCode {
349
- fn default ( ) -> RustCode {
379
+ fn default ( ) -> Self {
350
380
RustCode {
351
381
action_prefix : String :: from ( "" ) ,
352
382
action_suffix : String :: from ( "" ) ,
@@ -408,3 +438,29 @@ impl Default for RustCode {
408
438
}
409
439
}
410
440
}
441
+
442
+ impl Default for SmcatConfig {
443
+ fn default ( ) -> Self {
444
+ SmcatConfig {
445
+ features : SmcatFeatures :: default ( ) ,
446
+ code : SmcatCode :: default ( ) ,
447
+ }
448
+ }
449
+ }
450
+
451
+ impl Default for SmcatFeatures {
452
+ fn default ( ) -> Self {
453
+ SmcatFeatures { }
454
+ }
455
+ }
456
+
457
+ impl Default for SmcatCode {
458
+ fn default ( ) -> Self {
459
+ SmcatCode {
460
+ simple_state_node_style : String :: from ( "class=\" state simple\" " ) ,
461
+ parent_state_node_style : String :: from ( "class=\" state parent\" " ) ,
462
+ change_state_edge_style : String :: from ( "class=\" edge change-state\" " ) ,
463
+ transition_edge_style : String :: from ( "class=\" edge transition\" " ) ,
464
+ }
465
+ }
466
+ }
0 commit comments