pub fn dbg_contains<'v, V, I>(value: V, item: I) -> Result<'v, ()>Expand description
Debug contains validator: like contains() but mentions item in the
error message.
This is the dual of dbg_omits(). The is identical to contains()
except that item must be Debug + Copy and the error message is as
follows, where $item is the Debug representation of item:
values must contains $itemIf the collection is empty, this validator fails.
ยงExample
use rocket::form::{FromForm, FromFormField};
#[derive(PartialEq, Debug, Clone, Copy, FromFormField)]
enum Pet { Cat, Dog }
#[derive(FromForm)]
struct Foo {
best_pet: Pet,
#[field(validate = dbg_contains(Pet::Dog))]
#[field(validate = dbg_contains(&self.best_pet))]
pets: Vec<Pet>,
}