pub struct DurationRules {
pub const: Option<Duration>,
pub in: Vec<Duration>,
pub not_in: Vec<Duration>,
pub example: Vec<Duration>,
pub less_than: Option<LessThan>,
pub greater_than: Option<GreaterThan>,
}
Expand description
DurationRules describe the rules applied exclusively to the google.protobuf.Duration
well-known type.
Fields§
§const: Option<Duration>
const
dictates that the field must match the specified value of the google.protobuf.Duration
type exactly.
If the field’s value deviates from the specified value, an error message
will be generated.
message MyDuration {
// value must equal 5s
google.protobuf.Duration value = 1 \[(buf.validate.field).duration.const = "5s"\];
}
in: Vec<Duration>
in
asserts that the field must be equal to one of the specified values of the google.protobuf.Duration
type.
If the field’s value doesn’t correspond to any of the specified values,
an error message will be generated.
message MyDuration {
// value must be in list \[1s, 2s, 3s\]
google.protobuf.Duration value = 1 \[(buf.validate.field).duration.in = ["1s", "2s", "3s"]\];
}
not_in: Vec<Duration>
not_in
denotes that the field must not be equal to
any of the specified values of the google.protobuf.Duration
type.
If the field’s value matches any of these values, an error message will be
generated.
message MyDuration {
// value must not be in list \[1s, 2s, 3s\]
google.protobuf.Duration value = 1 \[(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]\];
}
example: Vec<Duration>
example
specifies values that the field may have. These values SHOULD
conform to other rules. example
values will not impact validation
but may be used as helpful guidance on how to populate the given field.
message MyDuration {
google.protobuf.Duration value = 1 [
(buf.validate.field).duration.example = { seconds: 1 },
(buf.validate.field).duration.example = { seconds: 2 },
];
}
less_than: Option<LessThan>
§greater_than: Option<GreaterThan>
Trait Implementations§
Source§impl Clone for DurationRules
impl Clone for DurationRules
Source§fn clone(&self) -> DurationRules
fn clone(&self) -> DurationRules
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DurationRules
impl Debug for DurationRules
Source§impl Default for DurationRules
impl Default for DurationRules
Source§impl Message for DurationRules
impl Message for DurationRules
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 PartialEq for DurationRules
impl PartialEq for DurationRules
impl StructuralPartialEq for DurationRules
Auto Trait Implementations§
impl Freeze for DurationRules
impl RefUnwindSafe for DurationRules
impl Send for DurationRules
impl Sync for DurationRules
impl Unpin for DurationRules
impl UnwindSafe for DurationRules
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request