#[non_exhaustive]pub struct MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,{
pub keys: Option<K::Validator>,
pub cel: Vec<CelProgram>,
pub values: Option<V::Validator>,
pub min_pairs: Option<usize>,
pub max_pairs: Option<usize>,
pub ignore: Ignore,
pub error_messages: Option<Box<BTreeMap<MapViolation, FixedStr>>>,
/* private fields */
}Expand description
Validator for types that implement ProtoMap.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.keys: Option<K::Validator>The validation rules to apply to the keys of this map field.
cel: Vec<CelProgram>§values: Option<V::Validator>The validation rules to apply to the keys of this map field.
min_pairs: Option<usize>The minimum amount of key-value pairs that this field should have in order to be valid.
max_pairs: Option<usize>The maximum amount of key-value pairs that this field should have in order to be valid.
ignore: Ignore§error_messages: Option<Box<BTreeMap<MapViolation, FixedStr>>>Implementations§
Source§impl<K, V> MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
impl<K, V> MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
pub fn builder() -> MapValidatorBuilder<K, V>
Source§impl<K, V> MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
impl<K, V> MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
Sourcepub fn validate_map<M>(
&self,
ctx: &mut ValidationCtx,
val: Option<&M>,
) -> ValidationResult
pub fn validate_map<M>( &self, ctx: &mut ValidationCtx, val: Option<&M>, ) -> ValidationResult
Validates the given map. Given as a separate method to avoid trait resolution issues given the implementation for several kinds of map.
Trait Implementations§
Source§impl<K, V> Clone for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
impl<K, V> Clone for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
Source§impl<K, V> Debug for MapValidator<K, V>where
K: ProtoValidation + Debug,
V: ProtoValidation + Debug,
K::Validator: Debug,
V::Validator: Debug,
impl<K, V> Debug for MapValidator<K, V>where
K: ProtoValidation + Debug,
V: ProtoValidation + Debug,
K::Validator: Debug,
V::Validator: Debug,
Source§impl<K, V> Default for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
impl<K, V> Default for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
Source§impl<'de, K, V> Deserialize<'de> for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
K::Validator: DeserializeOwned,
V::Validator: DeserializeOwned,
impl<'de, K, V> Deserialize<'de> for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
K::Validator: DeserializeOwned,
V::Validator: DeserializeOwned,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K, V> From<MapValidator<K, V>> for ProtoOptionwhere
K: ProtoValidation,
V: ProtoValidation,
impl<K, V> From<MapValidator<K, V>> for ProtoOptionwhere
K: ProtoValidation,
V: ProtoValidation,
Source§fn from(validator: MapValidator<K, V>) -> Self
fn from(validator: MapValidator<K, V>) -> Self
Converts to this type from the input type.
Source§impl<K, V> Hash for MapValidator<K, V>
impl<K, V> Hash for MapValidator<K, V>
Source§impl<K, V> PartialEq for MapValidator<K, V>where
K: ProtoValidation + PartialEq,
V: ProtoValidation + PartialEq,
K::Validator: PartialEq,
V::Validator: PartialEq,
impl<K, V> PartialEq for MapValidator<K, V>where
K: ProtoValidation + PartialEq,
V: ProtoValidation + PartialEq,
K::Validator: PartialEq,
V::Validator: PartialEq,
Source§impl<K, V> Serialize for MapValidator<K, V>
impl<K, V> Serialize for MapValidator<K, V>
Source§impl<K, V, M> Validator<M> for MapValidator<K, V>
impl<K, V, M> Validator<M> for MapValidator<K, V>
Source§fn check_consistency(&self) -> Result<(), Vec<ConsistencyError>>
fn check_consistency(&self) -> Result<(), Vec<ConsistencyError>>
Checks if the inputs of the validators are valid.
Source§fn check_cel_programs_with(
&self,
val: Self::Target,
) -> Result<(), Vec<CelError>>
fn check_cel_programs_with( &self, val: Self::Target, ) -> Result<(), Vec<CelError>>
Available on crate feature
cel only.Tests the CEL programs of this validator with the given value. Read more
Source§fn schema(&self) -> Option<ValidatorSchema>
fn schema(&self) -> Option<ValidatorSchema>
Returns the optional schema representation for this validator. Read more
Source§fn execute_validation(
&self,
ctx: &mut ValidationCtx,
val: Option<&Self::Target>,
) -> ValidationResult
fn execute_validation( &self, ctx: &mut ValidationCtx, val: Option<&Self::Target>, ) -> ValidationResult
Validates the Target, with customized settings.
Source§fn validate(&self, val: &Self::Target) -> Result<(), ValidationErrors>
fn validate(&self, val: &Self::Target) -> Result<(), ValidationErrors>
Validates the Target, with the
fail_fast setting set to true.Source§fn validate_option(
&self,
val: Option<&Self::Target>,
) -> Result<(), ValidationErrors>
fn validate_option( &self, val: Option<&Self::Target>, ) -> Result<(), ValidationErrors>
Validates the Target, with the
fail_fast setting set to true.Source§fn validate_with_ctx(
&self,
ctx: ValidationCtx,
val: &Self::Target,
) -> Result<(), ValidationErrors>
fn validate_with_ctx( &self, ctx: ValidationCtx, val: &Self::Target, ) -> Result<(), ValidationErrors>
Validates the Target, with customized settings.
Source§fn validate_option_with_ctx(
&self,
ctx: ValidationCtx,
val: Option<&Self::Target>,
) -> Result<(), ValidationErrors>
fn validate_option_with_ctx( &self, ctx: ValidationCtx, val: Option<&Self::Target>, ) -> Result<(), ValidationErrors>
Validates the Target, with customized settings.
impl<K, V> Eq for MapValidator<K, V>
impl<K, V> StructuralPartialEq for MapValidator<K, V>where
K: ProtoValidation,
V: ProtoValidation,
Auto Trait Implementations§
impl<K, V> Freeze for MapValidator<K, V>
impl<K, V> RefUnwindSafe for MapValidator<K, V>where
<K as ProtoValidation>::Validator: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
<V as ProtoValidation>::Validator: RefUnwindSafe,
impl<K, V> Send for MapValidator<K, V>
impl<K, V> Sync for MapValidator<K, V>
impl<K, V> Unpin for MapValidator<K, V>where
<K as ProtoValidation>::Validator: Unpin,
K: Unpin,
V: Unpin,
<V as ProtoValidation>::Validator: Unpin,
impl<K, V> UnwindSafe for MapValidator<K, V>where
<K as ProtoValidation>::Validator: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
<V as ProtoValidation>::Validator: UnwindSafe,
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Wrap the input message
T in a tonic::RequestSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Change the foreground color to black
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Change the background color to black
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Change the foreground color to red
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Change the background color to red
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Change the foreground color to green
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Change the background color to green
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Change the foreground color to yellow
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Change the background color to yellow
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Change the foreground color to blue
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Change the background color to blue
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to magenta
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to purple
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to purple
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Change the foreground color to cyan
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Change the background color to cyan
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Change the foreground color to white
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Change the background color to white
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Make the text bold
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Make the text dim
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Make the text italicized
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Make the text underlined
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Make the text blink
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Swap the foreground and background colors
Hide the text
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.