pub enum WellKnown {
Email(bool),
Hostname(bool),
Ip(bool),
Ipv4(bool),
Ipv6(bool),
Uri(bool),
UriRef(bool),
Address(bool),
Uuid(bool),
WellKnownRegex(i32),
}
Expand description
WellKnown rules provide advanced constraints against common string patterns
Variants§
Email(bool)
Email specifies that the field must be a valid email address as defined by RFC 5322
Hostname(bool)
Hostname specifies that the field must be a valid hostname as defined by RFC 1034. This constraint does not support internationalized domain names (IDNs).
Ip(bool)
Ip specifies that the field must be a valid IP (v4 or v6) address. Valid IPv6 addresses should not include surrounding square brackets.
Ipv4(bool)
Ipv4 specifies that the field must be a valid IPv4 address.
Ipv6(bool)
Ipv6 specifies that the field must be a valid IPv6 address. Valid IPv6 addresses should not include surrounding square brackets.
Uri(bool)
Uri specifies that the field must be a valid, absolute URI as defined by RFC 3986
UriRef(bool)
UriRef specifies that the field must be a valid URI as defined by RFC 3986 and may be relative or absolute.
Address(bool)
Address specifies that the field must be either a valid hostname as defined by RFC 1034 (which does not support internationalized domain names or IDNs), or it can be a valid IP (v4 or v6).
Uuid(bool)
Uuid specifies that the field must be a valid UUID as defined by RFC 4122
WellKnownRegex(i32)
WellKnownRegex specifies a common well known pattern defined as a regex.
Implementations§
Source§impl WellKnown
impl WellKnown
Sourcepub fn merge(
field: &mut Option<WellKnown>,
tag: u32,
wire_type: WireType,
buf: &mut impl Buf,
ctx: DecodeContext,
) -> Result<(), DecodeError>
pub fn merge( field: &mut Option<WellKnown>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into self.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.