pub struct MapRules {
pub min_pairs: Option<u64>,
pub max_pairs: Option<u64>,
pub no_sparse: Option<bool>,
pub keys: Option<Box<FieldRules>>,
pub values: Option<Box<FieldRules>>,
pub ignore_empty: Option<bool>,
}
Expand description
MapRules describe the constraints applied to map
values
Fields§
§min_pairs: Option<u64>
MinPairs specifies that this field must have the specified number of KVs at a minimum
max_pairs: Option<u64>
MaxPairs specifies that this field must have the specified number of KVs at a maximum
no_sparse: Option<bool>
NoSparse specifies values in this field cannot be unset. This only applies to map’s with message value types.
keys: Option<Box<FieldRules>>
Keys specifies the constraints to be applied to each key in the field.
values: Option<Box<FieldRules>>
Values specifies the constraints to be applied to the value of each key in the field. Message values will still have their validations evaluated unless skip is specified here.
ignore_empty: Option<bool>
IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty
Implementations§
Source§impl MapRules
impl MapRules
Sourcepub fn min_pairs(&self) -> u64
pub fn min_pairs(&self) -> u64
Returns the value of min_pairs
, or the default value if min_pairs
is unset.
Sourcepub fn max_pairs(&self) -> u64
pub fn max_pairs(&self) -> u64
Returns the value of max_pairs
, or the default value if max_pairs
is unset.
Sourcepub fn no_sparse(&self) -> bool
pub fn no_sparse(&self) -> bool
Returns the value of no_sparse
, or the default value if no_sparse
is unset.
Sourcepub fn ignore_empty(&self) -> bool
pub fn ignore_empty(&self) -> bool
Returns the value of ignore_empty
, or the default value if ignore_empty
is unset.
Trait Implementations§
Source§impl Message for MapRules
impl Message for MapRules
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.Source§impl ReflectMessage for MapRules
impl ReflectMessage for MapRules
Source§fn descriptor(&self) -> MessageDescriptor
fn descriptor(&self) -> MessageDescriptor
MessageDescriptor
describing the type of this message.Source§fn transcode_to_dynamic(&self) -> DynamicMessagewhere
Self: Sized,
fn transcode_to_dynamic(&self) -> DynamicMessagewhere
Self: Sized,
DynamicMessage
by going
through the byte representation.