From 6e8effdaa2b47f4056a00d301a9e7a5a1a2fd8dc Mon Sep 17 00:00:00 2001 From: Caroline Glassberg-Powell Date: Sun, 28 Apr 2019 18:45:40 +0100 Subject: 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. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'README.md') 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 -- cgit v1.2.3