aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorCaroline Glassberg-Powell2019-04-28 18:45:40 +0100
committerCaroline Glassberg-Powell2019-04-28 19:01:08 +0100
commit6e8effdaa2b47f4056a00d301a9e7a5a1a2fd8dc (patch)
tree781b99ec57192adb777681243b8161fd37a10bae /README.md
parent4b9fe3939b106c151bff11e490a41212559f9a4a (diff)
downloadvalidator-6e8effdaa2b47f4056a00d301a9e7a5a1a2fd8dc.tar.bz2
Issue #69: Change `range` to require only one arg
Currently range is hard-coded to take both max and min. This is unhelpful in cases where we may only want to check one of the bounds. Update so that it behaves more like the `length` validator and can take either max or min, as well as both. Also ensure that at least one of them is supplied.
Diffstat (limited to 'README.md')
-rw-r--r--README.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/README.md b/README.md
index c9bda8d..ce86ead 100644
--- a/README.md
+++ b/README.md
@@ -179,14 +179,16 @@ Examples:
```
### range
-Tests whether a number is in the given range. `range` takes 2 number arguments: `min` and `max`.
+Tests whether a number is in the given range. `range` takes between 1 and 2 number arguments: `min` and `max`.
Examples:
```rust
#[validate(range(min = "1", max = "10"))]
+#[validate(range(min = "1"))]
#[validate(range(min = "1", max = "10.8"))]
#[validate(range(min = "1.1", max = "10.8"))]
+#[validate(range(max = "10.8"))]
```
### must_match