Update composing_validators.md

This commit is contained in:
liuzicheng1987
2023-11-18 22:56:39 +01:00
committed by GitHub
parent d21782a8d8
commit ff8220e0e6
+9
View File
@@ -19,6 +19,15 @@ struct Person {
};
```
However, if you pass more than one constraint to `rfl::Validator`, they will be automatically connected using `rfl::AllOf`,
so you might as well write:
```cpp
using Age = rfl::Validator<int, rfl::Minimum<0>, rfl::Maximum<130>>;
...
```
You can also nest composed validators. For instance, in this case the age must either be 0-10 or 40-130.
```cpp