File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -148,18 +148,14 @@ Therefore, it can be treated much like a composite function
148
148
fn main () {
149
149
struct StartWithHelloRule ;
150
150
struct StartWithByeRule ;
151
-
152
151
struct EndWithJohnRule ;
153
152
154
- type StartWithHelloOrByeRule = Or <StartWithHelloRule , StartWithByeRule >;
155
- type GreetingRule = And <StartWithHelloOrByeRule , EndWithJohnRule >;
156
-
157
- type Greeting = Refined <GreetingRule >;
153
+ type GreetingRule = And <Or <StartWithHelloRule , StartWithByeRule >, EndWithJohnRule >;
158
154
159
155
assert! (GreetingRule :: validate (" Hello! Nice to meet you John" . to_string ()). is_ok ());
160
- assert! (Greeting :: validate (" Bye! Have a good day John" . to_string ()). is_ok ());
161
- assert! (Greeting :: validate (" How are you? Have a good day John" . to_string ()). is_err ());
162
- assert! (Greeting :: validate (" Bye! Have a good day Tom" . to_string ()). is_err ());
156
+ assert! (GreetingRule :: validate (" Bye! Have a good day John" . to_string ()). is_ok ());
157
+ assert! (GreetingRule :: validate (" How are you? Have a good day John" . to_string ()). is_err ());
158
+ assert! (GreetingRule :: validate (" Bye! Have a good day Tom" . to_string ()). is_err ());
163
159
}
164
160
```
165
161
You can’t perform that action at this time.
0 commit comments