### Implement AsRegex for Foreign Types Source: https://docs.rs/validator/latest/validator/trait.AsRegex.html Examples of implementing AsRegex for various synchronization primitives and regex types. ```rust impl AsRegex for &Arc>> fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for &Arc>> fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for &Mutex> fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for &Mutex> fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for &OnceLock fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for LazyLock fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for Regex fn as_regex(&self) -> Cow<'_, Regex> ``` ```rust impl AsRegex for &T where T: AsRegex, fn as_regex(&self) -> Cow<'_, Regex> ``` -------------------------------- ### Install Validator Crate Source: https://docs.rs/validator/latest/validator/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Add the validator crate to your Cargo.toml dependencies with the derive feature enabled. ```toml [dependencies] validator = { version = "0.16", features = ["derive"] } ``` -------------------------------- ### fn as_regex(&self) -> Cow<'_, Regex> Source: https://docs.rs/validator/latest/validator/trait.AsRegex.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves a regex instance as a Cow (Clone-on-write) wrapper. This method is implemented for various types including Regex, LazyLock, and several Mutex/OnceCell/OnceLock combinations. ```APIDOC ## fn as_regex(&self) -> Cow<'_, Regex> ### Description Returns a reference or an owned instance of a Regex object wrapped in a Cow. This is the primary method for the AsRegex trait. ### Signature `fn as_regex(&self) -> Cow<'_, Regex>` ### Implementations - Regex - LazyLock - &OnceLock - &Mutex> - &Mutex> - &Arc>> - &Arc>> - &T where T: AsRegex ``` -------------------------------- ### fn as_regex(&self) -> Cow<'_, Regex> Source: https://docs.rs/validator/latest/validator/trait.AsRegex.html?search=std%3A%3Avec The as_regex method is the required function for the AsRegex trait. It returns a borrowed or owned Regex wrapped in a Cow (Copy-on-Write) smart pointer. ```APIDOC ## fn as_regex(&self) -> Cow<'_, Regex> ### Description Retrieves a regular expression from the implementing type. This method returns a `Cow<'_, Regex>`, which allows the implementation to return either a reference to an existing `Regex` or an owned `Regex` instance. ### Signature `fn as_regex(&self) -> Cow<'_, Regex>` ### Returns - **Cow<'_, Regex>** - A copy-on-write pointer to the regular expression. ``` -------------------------------- ### Define and Validate Structs with Validator Source: https://docs.rs/validator/latest/validator/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Use the Validate derive macro to define validation rules on struct fields and execute validation using the validate() method. ```rust use serde::Deserialize; // A trait that the Validate derive will impl use validator::{Validate, ValidationError}; #[derive(Debug, Validate, Deserialize)] struct SignupData { #[validate(email)] mail: String, #[validate(url)] site: String, #[validate(length(min = 1), custom(function = "validate_unique_username"))] #[serde(rename = "firstName")] first_name: String, #[validate(range(min = 18, max = 20))] age: u32, } fn validate_unique_username(username: &str) -> Result<(), ValidationError> { if username == "xXxShad0wxXx" { // the value of the username will automatically be added later return Err(ValidationError::new("terrible_username")); } Ok(()) } match signup_data.validate() { Ok(_) => (), Err(e) => return e; }; ``` -------------------------------- ### fn validate_regex(&self, regex: impl AsRegex) -> bool Source: https://docs.rs/validator/latest/validator/trait.ValidateRegex.html?search=std%3A%3Avec Validates the implementing type against a given regular expression. ```APIDOC ## fn validate_regex(&self, regex: impl AsRegex) -> bool ### Description Validates the current instance against a provided regular expression. Returns true if the validation succeeds, false otherwise. ### Parameters - **regex** (impl AsRegex) - The regular expression to validate against. ### Returns - **bool** - True if the value matches the regex, false otherwise. ``` -------------------------------- ### ValidateUrl::as_url_string Source: https://docs.rs/validator/latest/validator/trait.ValidateUrl.html?search=u32+-%3E+bool Converts the implementing type into a URL string representation. ```APIDOC ## fn as_url_string(&self) -> Option> ### Description Required method to retrieve the URL as a string. Implementations must return an `Option` containing the `Cow` string representation. ### Returns - **Option>** - The URL string if available, otherwise `None`. ``` -------------------------------- ### fn validate(&self) -> Result<(), ValidationErrors> Source: https://docs.rs/validator/latest/validator/trait.Validate.html?search= Validates the implementing structure and returns a Result. If validation fails, it returns a ValidationErrors object containing the details of the failures. ```APIDOC ## fn validate(&self) -> Result<(), ValidationErrors> ### Description Validates the data structure. This method is the primary entry point for performing validation on types that implement the Validate trait. ### Signature `fn validate(&self) -> Result<(), ValidationErrors>` ### Returns - **Result<(), ValidationErrors>** - Returns Ok(()) if the structure is valid, or a ValidationErrors instance if validation fails. ``` -------------------------------- ### validate_must_match(a: T, b: T) -> bool Source: https://docs.rs/validator/latest/validator/fn.validate_must_match.html Validates that the two provided fields match. Both fields are treated as optionals. ```APIDOC ## validate_must_match ### Description Validates that the 2 given fields match. Both fields are optionals. ### Signature `pub fn validate_must_match(a: T, b: T) -> bool` ### Parameters - **a** (T: Eq) - The first value to compare. - **b** (T: Eq) - The second value to compare. ### Returns - **bool** - Returns true if the fields match, false otherwise. ``` -------------------------------- ### ValidateIp Trait Methods Source: https://docs.rs/validator/latest/validator/trait.ValidateIp.html?search=u32+-%3E+bool The ValidateIp trait provides methods to check if a value represents a valid IPv4 address, IPv6 address, or a general IP address. ```APIDOC ## fn validate_ipv4(&self) -> bool ### Description Validates whether the given string is an IP V4 address. ## fn validate_ipv6(&self) -> bool ### Description Validates whether the given string is an IP V6 address. ## fn validate_ip(&self) -> bool ### Description Validates whether the given string is a valid IP address. ``` -------------------------------- ### AsRegex Trait Definition Source: https://docs.rs/validator/latest/validator/trait.AsRegex.html?search= The core trait definition requiring the implementation of the as_regex method. ```rust pub trait AsRegex { // Required method fn as_regex(&self) -> Cow<'_, Regex>; } ``` -------------------------------- ### ValidateUrl Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateUrl.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The core trait definition including the required as_url_string method and the provided validate_url method. ```rust pub trait ValidateUrl { // Required method fn as_url_string(&self) -> Option>; // Provided method fn validate_url(&self) -> bool { ... } } ``` -------------------------------- ### ValidateIp Trait Implementation Source: https://docs.rs/validator/latest/validator/struct.ValidationError.html?search= Provides IP validation methods for types that implement ToString. ```rust fn validate_ipv4(&self) -> bool ``` ```rust fn validate_ipv6(&self) -> bool ``` ```rust fn validate_ip(&self) -> bool ``` -------------------------------- ### ValidateIp Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateIp.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The core trait definition containing methods for IP validation. ```rust pub trait ValidateIp { // Required methods fn validate_ipv4(&self) -> bool; fn validate_ipv6(&self) -> bool; fn validate_ip(&self) -> bool; } ``` -------------------------------- ### Auto Trait Implementations for ValidationErrorsKind Source: https://docs.rs/validator/latest/validator/enum.ValidationErrorsKind.html?search=std%3A%3Avec Lists the standard auto traits implemented for the ValidationErrorsKind enum. ```rust impl Freeze for ValidationErrorsKind impl RefUnwindSafe for ValidationErrorsKind impl Send for ValidationErrorsKind impl Sync for ValidationErrorsKind impl Unpin for ValidationErrorsKind impl UnsafeUnpin for ValidationErrorsKind impl UnwindSafe for ValidationErrorsKind ``` -------------------------------- ### validator::validate_must_match Source: https://docs.rs/validator/latest/validator/all.html?search=u32+-%3E+bool Validates that two given fields match. ```APIDOC ## validator::validate_must_match ### Description Validates that the 2 given fields match. ### Signature `fn validate_must_match(a: T, b: T) -> bool` ``` -------------------------------- ### validator::ValidateRange Source: https://docs.rs/validator/latest/validator/all.html?search=u32+-%3E+bool Methods for validating ranges, including less_than, greater_than, and validate_range. ```APIDOC ## validator::ValidateRange ### Methods - **less_than**: `&ValidateRange, T -> Option` - **greater_than**: `&ValidateRange, T -> Option` - **validate_range**: `&ValidateRange, Option, Option, Option, Option -> bool` ``` -------------------------------- ### ValidateUrl::validate_url Source: https://docs.rs/validator/latest/validator/trait.ValidateUrl.html?search=u32+-%3E+bool Validates whether the string representation of the implementing type is a valid URL. ```APIDOC ## fn validate_url(&self) -> bool ### Description Validates whether the string given is a URL. This is a provided method on the `ValidateUrl` trait. ### Returns - **bool** - Returns `true` if the URL is valid, otherwise `false`. ``` -------------------------------- ### fn validate_length Source: https://docs.rs/validator/latest/validator/trait.ValidateLength.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Validates the length of the implementing type against optional constraints. If the 'equal' parameter is provided, it takes precedence over 'min' and 'max'. ```APIDOC ## fn validate_length(&self, min: Option, max: Option, equal: Option) -> bool ### Description Validates the length of the value. If the validator has `equal` set, it will ignore any `min` and `max` value. ### Parameters - **min** (Option) - Optional - The minimum length allowed. - **max** (Option) - Optional - The maximum length allowed. - **equal** (Option) - Optional - The exact length required. ### Returns - **bool** - Returns true if the length satisfies the provided constraints, false otherwise. ``` -------------------------------- ### validate_must_match function signature Source: https://docs.rs/validator/latest/validator/fn.validate_must_match.html?search=u32+-%3E+bool The function signature for validating that two fields match. ```rust pub fn validate_must_match(a: T, b: T) -> bool ``` -------------------------------- ### validate_regex Source: https://docs.rs/validator/latest/validator/trait.ValidateRegex.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Validates the implementing type against a provided regular expression. ```APIDOC ## fn validate_regex(&self, regex: impl AsRegex) -> bool ### Description Validates the current instance against a specified regular expression. Returns true if the validation succeeds, otherwise false. ### Parameters - **regex** (impl AsRegex) - Required - The regular expression to validate against. ``` -------------------------------- ### Define the Validate trait Source: https://docs.rs/validator/latest/validator/trait.Validate.html The core trait definition for implementing validation logic on structs. ```rust pub trait Validate { // Required method fn validate(&self) -> Result<(), ValidationErrors>; } ``` -------------------------------- ### validate_ip Source: https://docs.rs/validator/latest/validator/trait.ValidateIp.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Validates whether the given string is a valid IP address (IPv4 or IPv6). ```APIDOC ## fn validate_ip(&self) -> bool ### Description Validates whether the given string is an IP. ### Returns - **bool** - Returns true if the string is a valid IP address, false otherwise. ``` -------------------------------- ### validate_ipv6 Source: https://docs.rs/validator/latest/validator/trait.ValidateIp.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Validates whether the given string is an IPv6 address. ```APIDOC ## fn validate_ipv6(&self) -> bool ### Description Validates whether the given string is an IP V6. ### Returns - **bool** - Returns true if the string is a valid IPv6 address, false otherwise. ``` -------------------------------- ### Option Implementation of ValidateArgs Source: https://docs.rs/validator/latest/validator/trait.ValidateArgs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implementation of the ValidateArgs trait for Option types. ```rust impl<'v_a, T, U> ValidateArgs<'v_a> for Option where T: ValidateArgs<'v_a, Args = U>, Source§ #### type Args = U Source§ #### fn validate_with_args(&self, args: Self::Args) -> Result<(), ValidationErrors> ``` -------------------------------- ### validator::ValidateRegex Source: https://docs.rs/validator/latest/validator/all.html?search=u32+-%3E+bool Method for validating a field against a regex. ```APIDOC ## validator::ValidateRegex ### Methods - **validate_regex**: `&ValidateRegex, AsRegex -> bool` ``` -------------------------------- ### fn validate_contains(&self, needle: &str) -> bool Source: https://docs.rs/validator/latest/validator/trait.ValidateContains.html?search= Checks if the provided needle string is contained within the implementing type. ```APIDOC ## fn validate_contains(&self, needle: &str) -> bool ### Description Checks if the specified needle string exists within the current instance. ### Parameters - **needle** (&str) - The string to search for within the implementing type. ### Returns - **bool** - Returns true if the needle is found, otherwise false. ``` -------------------------------- ### ValidateEmail Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateEmail.html Defines the interface for email validation, requiring an implementation of as_email_string and providing a default validate_email method. ```rust pub trait ValidateEmail { // Required method fn as_email_string(&self) -> Option>; // Provided method fn validate_email(&self) -> bool { ... } } ``` -------------------------------- ### fn validate(&self) -> Result<(), ValidationErrors> Source: https://docs.rs/validator/latest/validator/trait.Validate.html?search=std%3A%3Avec The validate method is the primary interface for triggering validation logic on a struct. It returns an empty Ok result on success or a ValidationErrors object if validation fails. ```APIDOC ## fn validate(&self) -> Result<(), ValidationErrors> ### Description Performs validation on the implementing type. This method is used to verify that the data within the struct adheres to defined validation rules. ### Signature `fn validate(&self) -> Result<(), ValidationErrors>` ### Returns - **Result<(), ValidationErrors>** - Returns `Ok(())` if validation passes, or `Err(ValidationErrors)` containing the details of the validation failures. ``` -------------------------------- ### validator::ValidateRange::less_than Source: https://docs.rs/validator/latest/validator/trait.ValidateRange.html?search=u32+-%3E+bool Checks if the provided value is less than the range boundary. ```APIDOC ## validator::ValidateRange::less_than ### Description Validates if the input value is less than the defined range boundary. ### Signature `&ValidateRange, T -> Option` ``` -------------------------------- ### validate_ipv4 Source: https://docs.rs/validator/latest/validator/trait.ValidateIp.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Validates whether the given string is an IPv4 address. ```APIDOC ## fn validate_ipv4(&self) -> bool ### Description Validates whether the given string is an IP V4. ### Returns - **bool** - Returns true if the string is a valid IPv4 address, false otherwise. ``` -------------------------------- ### ValidateRegex Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateRegex.html The core trait definition requiring the implementation of the validate_regex method. ```rust pub trait ValidateRegex { // Required method fn validate_regex(&self, regex: impl AsRegex) -> bool; } ``` -------------------------------- ### ValidateLength Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateLength.html The core trait definition requiring a length method and providing a default validate_length implementation. ```rust pub trait ValidateLength where T: PartialEq + PartialOrd, { // Required method fn length(&self) -> Option; // Provided method fn validate_length( &self, min: Option, max: Option, equal: Option, ) -> bool { ... } } ``` -------------------------------- ### validator::ValidateLength Source: https://docs.rs/validator/latest/validator/all.html?search=u32+-%3E+bool Method for validating the length of a field. ```APIDOC ## validator::ValidateLength ### Methods - **validate_length**: `&ValidateLength, Option, Option, Option -> bool` ``` -------------------------------- ### ValidateRange Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateRange.html The core trait definition including required methods for comparison and a provided method for range validation. ```rust pub trait ValidateRange { // Required methods fn greater_than(&self, max: T) -> Option; fn less_than(&self, min: T) -> Option; // Provided method fn validate_range( &self, min: Option, max: Option, exclusive_min: Option, exclusive_max: Option, ) -> bool { ... } } ``` -------------------------------- ### validate_does_not_contain Source: https://docs.rs/validator/latest/validator/trait.ValidateDoesNotContain.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Checks if the implementing type does not contain the specified needle string. ```APIDOC ## fn validate_does_not_contain(&self, needle: &str) -> bool ### Description Checks whether the current instance does not contain the provided needle string. ### Parameters - **needle** (&str) - Required - The string to search for within the instance. ### Returns - **bool** - Returns true if the needle is not found, otherwise false. ``` -------------------------------- ### ValidateArgs Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateArgs.html?search= The core trait definition requiring the implementation of validate_with_args and an associated Args type. ```rust pub trait ValidateArgs<'v_a> { type Args; // Required method fn validate_with_args( &self, args: Self::Args, ) -> Result<(), ValidationErrors>; } ``` -------------------------------- ### validator::ValidateRange::validate_range Source: https://docs.rs/validator/latest/validator/trait.ValidateRange.html?search=u32+-%3E+bool Validates a value against a specified range. ```APIDOC ## validator::ValidateRange::validate_range ### Description Validates if the provided value falls within the specified range boundaries. ### Signature `&ValidateRange, Option, Option, Option, Option -> bool` ``` -------------------------------- ### ValidationError Struct Definition Source: https://docs.rs/validator/latest/validator/struct.ValidationError.html?search=u32+-%3E+bool The primary structure used to represent validation errors. ```rust pub struct ValidationError { pub code: Cow<'static, str>, pub message: Option>, pub params: HashMap, Value>, } ``` -------------------------------- ### validator::ValidateRange::greater_than Source: https://docs.rs/validator/latest/validator/trait.ValidateRange.html?search=u32+-%3E+bool Checks if the provided value is greater than the range boundary. ```APIDOC ## validator::ValidateRange::greater_than ### Description Validates if the input value is greater than the defined range boundary. ### Signature `&ValidateRange, T -> Option` ``` -------------------------------- ### ValidationErrorsKind Enum Definition Source: https://docs.rs/validator/latest/validator/enum.ValidationErrorsKind.html?search=u32+-%3E+bool The core enum structure defining how validation errors are categorized. ```rust pub enum ValidationErrorsKind { Struct(Box), List(BTreeMap>), Field(Vec), } ``` -------------------------------- ### ValidateRange Trait Methods Source: https://docs.rs/validator/latest/validator/trait.ValidateRange.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods available on types implementing the ValidateRange trait for range validation. ```APIDOC ## fn greater_than(&self, max: T) -> Option Checks if the value is greater than the provided maximum. ## fn less_than(&self, min: T) -> Option Checks if the value is less than the provided minimum. ## fn validate_range(&self, min: Option, max: Option, exclusive_min: Option, exclusive_max: Option) -> bool Validates that the value is within the defined range. Parameters are optional and only validated if provided (not None). ``` -------------------------------- ### ValidationErrors struct definition Source: https://docs.rs/validator/latest/validator/struct.ValidationErrors.html The primary structure for holding validation errors as a map of field names to error kinds. ```rust pub struct ValidationErrors(pub HashMap, ValidationErrorsKind>); ``` -------------------------------- ### ValidationErrors::merge_all Source: https://docs.rs/validator/latest/validator/struct.ValidationErrors.html?search=u32+-%3E+bool Combines a parent validation result with multiple nested validation results for a vector field. ```APIDOC ## pub fn merge_all(parent: Result<(), ValidationErrors>, field: &'static str, children: Vec>) -> Result<(), ValidationErrors> ### Description Returns the combined outcome of a struct’s validation result along with the nested validation results for a field that contains a vector of validating structs. ### Parameters - **parent** (Result<(), ValidationErrors>) - The primary validation result. - **field** (&'static str) - The field name associated with the children results. - **children** (Vec>) - A vector of nested validation results. ``` -------------------------------- ### ValidateContains Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateContains.html The core trait definition requiring the implementation of the validate_contains method. ```rust pub trait ValidateContains { // Required method fn validate_contains(&self, needle: &str) -> bool; } ``` -------------------------------- ### ValidationErrors::merge Source: https://docs.rs/validator/latest/validator/struct.ValidationErrors.html?search=u32+-%3E+bool Combines a parent validation result with a nested field validation result. ```APIDOC ## pub fn merge(parent: Result<(), ValidationErrors>, field: &'static str, child: Result<(), ValidationErrors>) -> Result<(), ValidationErrors> ### Description Returns the combined outcome of a struct’s validation result along with the nested validation result for one of its fields. ### Parameters - **parent** (Result<(), ValidationErrors>) - The primary validation result. - **field** (&'static str) - The field name associated with the child result. - **child** (Result<(), ValidationErrors>) - The nested validation result. ``` -------------------------------- ### ValidateDoesNotContain Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateDoesNotContain.html The trait definition requiring the implementation of the validate_does_not_contain method. ```rust pub trait ValidateDoesNotContain { // Required method fn validate_does_not_contain(&self, needle: &str) -> bool; } ``` -------------------------------- ### ValidateRequired Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateRequired.html?search= Defines the trait structure including the required is_some method and the provided validate_required method. ```rust pub trait ValidateRequired { // Required method fn is_some(&self) -> bool; // Provided method fn validate_required(&self) -> bool { ... } } ``` -------------------------------- ### ValidateNonControlCharacter::validate_non_control_character Source: https://docs.rs/validator/latest/validator/trait.ValidateNonControlCharacter.html?search=u32+-%3E+bool Validates that the implementing type contains no control characters. ```APIDOC ## fn validate_non_control_character(&self) -> bool ### Description Checks if the string contains any control characters. Returns true if no control characters are found, false otherwise. ### Returns - **bool** - True if the string is free of control characters, false otherwise. ``` -------------------------------- ### ValidateNonControlCharacter Trait Definition Source: https://docs.rs/validator/latest/validator/trait.ValidateNonControlCharacter.html The trait definition including the required iterator method and the provided validation method. ```rust pub trait ValidateNonControlCharacter { // Required method fn as_non_control_character_iterator( &self, ) -> Box + '_>; // Provided method fn validate_non_control_character(&self) -> bool { ... } } ``` -------------------------------- ### ValidateNonControlCharacter::as_non_control_character_iterator Source: https://docs.rs/validator/latest/validator/trait.ValidateNonControlCharacter.html?search=u32+-%3E+bool Returns an iterator over the non-control characters of the implementing type. ```APIDOC ## fn as_non_control_character_iterator(&self) -> Box + '_> ### Description Returns an iterator that yields only the non-control characters from the underlying string representation. ### Returns - **Box + '_>** - An iterator over the non-control characters. ``` -------------------------------- ### ValidationErrors::has_error Source: https://docs.rs/validator/latest/validator/struct.ValidationErrors.html?search=u32+-%3E+bool Checks if a validation result contains errors for a specific field. ```APIDOC ## pub fn has_error(result: &Result<(), ValidationErrors>, field: &'static str) -> bool ### Description Returns a boolean indicating whether a validation result includes validation errors for a given field. This is useful for determining if nested struct validations should proceed. ### Parameters - **result** (&Result<(), ValidationErrors>) - The validation result to inspect. - **field** (&'static str) - The name of the field to check for errors. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.