File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ mod tests {
530
530
#[ derive( Serialize , Deserialize ) ]
531
531
struct TestConfig ;
532
532
impl Config for TestConfig {
533
- type Predicate = predicate:: True ;
533
+ type Predicate = predicate:: Predicates ;
534
534
type Behaviour = TestBehaviours < Self > ;
535
535
}
536
536
type TC = TestConfig ;
Original file line number Diff line number Diff line change @@ -24,6 +24,17 @@ pub trait FromAny: Sized {
24
24
fn from_any ( x : impl Any ) -> Option < Self > ;
25
25
}
26
26
27
+ pub trait IntoAny {
28
+ fn into_any < T : FromAny > ( self ) -> Option < T >
29
+ where
30
+ Self : ' static + Sized ,
31
+ {
32
+ T :: from_any ( self )
33
+ }
34
+ }
35
+
36
+ impl < T > IntoAny for T { }
37
+
27
38
pub trait Cast {
28
39
fn cast < T : ' static > ( & self ) -> Option < & T > ;
29
40
fn cast_mut < T : ' static > ( & mut self ) -> Option < & mut T > ;
@@ -369,7 +380,7 @@ mod tests {
369
380
#[ derive( Serialize , Deserialize ) ]
370
381
struct TestConfig ;
371
382
impl Config for TestConfig {
372
- type Predicate = predicate:: True ;
383
+ type Predicate = predicate:: Predicates ;
373
384
type Behaviour = RunCountBehaviour ;
374
385
}
375
386
@@ -383,17 +394,17 @@ mod tests {
383
394
Transition {
384
395
src: vec![ "A" . into( ) ] ,
385
396
dst: vec![ "B" . into( ) ] ,
386
- predicate: predicate:: True ,
397
+ predicate: predicate:: True . into_any ( ) . unwrap ( ) ,
387
398
} ,
388
399
Transition {
389
400
src: vec![ "B" . into( ) ] ,
390
401
dst: vec![ "C" . into( ) ] ,
391
- predicate: predicate:: True ,
402
+ predicate: predicate:: True . into_any ( ) . unwrap ( ) ,
392
403
} ,
393
404
Transition {
394
405
src: vec![ "C" . into( ) ] ,
395
406
dst: vec![ "A" . into( ) ] ,
396
- predicate: predicate:: True ,
407
+ predicate: predicate:: True . into_any ( ) . unwrap ( ) ,
397
408
} ,
398
409
] ;
399
410
// init plan to A
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ pub enum Predicates {
40
40
AnyFailure ,
41
41
}
42
42
43
- #[ derive( Serialize , Deserialize , FromAny ) ]
43
+ #[ derive( Serialize , Deserialize ) ]
44
44
pub struct True ;
45
45
impl Predicate for True {
46
46
fn evaluate ( & self , _: & Plan < impl Config > , _: & [ String ] ) -> bool {
You can’t perform that action at this time.
0 commit comments