pub struct BytesValidator<'a> {Show 14 fields
pub len: Option<u64>,
pub min_len: Option<u64>,
pub max_len: Option<u64>,
pub pattern: Option<Regex>,
pub prefix: Option<&'a [u8]>,
pub suffix: Option<&'a [u8]>,
pub contains: Option<&'a [u8]>,
pub in_: Option<Box<[&'a [u8]]>>,
pub not_in: Option<Box<[&'a [u8]]>>,
pub well_known: Option<WellKnown>,
pub const_: Option<&'a [u8]>,
pub cel: Option<Box<[CelRule]>>,
pub required: Option<bool>,
pub ignore: Option<Ignore>,
}Expand description
Used by the bytes macro to define validation rules.
Fieldsยง
ยงlen: Option<u64>Specifies the exact length for this bytes field to be considered valid.
min_len: Option<u64>The minimum length for this field in order to be considered valid.
max_len: Option<u64>The maximum length for this field in order to be considered valid.
pattern: Option<Regex>The pattern that this field must match in order to be valid.
prefix: Option<&'a [u8]>A prefix that this field must contain in order to be valid.
suffix: Option<&'a [u8]>A suffix that this field must contain in order to be valid.
contains: Option<&'a [u8]>A subset of bytes that this field must contain in order to be valid.
in_: Option<Box<[&'a [u8]]>>Only the values in this list will be considered valid for this field.
not_in: Option<Box<[&'a [u8]]>>The values in this list will be considered invalid for this field.
well_known: Option<WellKnown>ยงconst_: Option<&'a [u8]>Only this specific value will be considered valid for this field.
cel: Option<Box<[CelRule]>>Adds custom validation using one or more CelRules to this field.
required: Option<bool>Marks the field as invalid if unset.
ignore: Option<Ignore>Implementationsยง
Sourceยงimpl<'a> BytesValidator<'a>
impl<'a> BytesValidator<'a>
Sourcepub fn builder() -> BytesValidatorBuilder<'a>
pub fn builder() -> BytesValidatorBuilder<'a>
Create an instance of BytesValidator using the builder syntax