pub struct ValidateErrorStore(pub Arc<[(String, Box<dyn LocaleMessage>)]>);
Expand description
ValidateErrorStore
is a structure used to store validation errors, where each error consists
of a String
key and an associated Box<dyn LocaleMessage>
value. The key represents
an identifier (e.g., field name or error code), while the LocaleMessage
represents
a localizable message for the associated validation error.
This structure is designed to be Default
and makes use of an Arc<[]>
to share ownership
of the data, enabling efficient cloning and concurrent usage in multithreaded contexts.
§Fields
0
: A reference-counted array (Arc<[]>
) of tuples containing:String
: The identifier for the validation error.Box<dyn LocaleMessage>
: A boxed trait object to represent a localizable message dynamically.
§Traits
The struct derives the Default
trait so it can be initialized with an empty error store.
Tuple Fields§
§0: Arc<[(String, Box<dyn LocaleMessage>)]>
Implementations§
Source§impl ValidateErrorStore
impl ValidateErrorStore
Sourcepub fn as_original_message(&self) -> Arc<[String]>
pub fn as_original_message(&self) -> Arc<[String]>
Converts the internal vector representation of the original message
into an Arc<[String]>
, a thread-safe, shared, and reference-counted slice of strings.
§Returns
An Arc<[String]>
containing the original message as a shared reference. The
Arc
allows multiple threads to safely share ownership of the message data without
requiring additional cloning or copying of the underlying strings.
§Usage
This method can be used when you need a thread-safe, immutable reference to the original message structure, allowing for efficient sharing of data across threads.
§Implementation
Internally, the method calls as_original_message_vec()
to retrieve the original
message as a Vec<String>
and then converts it to an Arc<[String]>
.
Sourcepub fn as_original_message_vec(&self) -> Vec<String>
pub fn as_original_message_vec(&self) -> Vec<String>
Converts the current collection into a Vec<String>
containing the original messages.
§Description
This method iterates over the elements of the internal collection, extracts the original
message (assumed to be stored as the first element of each component, e.0
), clones it,
and collects all the cloned messages into a new Vec<String>
.
§Returns
A Vec<String>
containing the cloned original messages from each element in the collection.
§Notes
- The internal structure
self.0
must be iterable, and each element must have a0
field containing aString
-like value. - The result is a completely new vector and does not modify the internal state of the current collection.
§Complexity
This method has a time complexity of O(n), where n is the number of elements in
the internal collection self.0
.
Sourcepub fn as_validate_error_collector(&self) -> ValidateErrorCollector
pub fn as_validate_error_collector(&self) -> ValidateErrorCollector
Converts the current instance into a ValidateErrorCollector
.
This method takes the current object, clones it, and converts it into a
ValidateErrorCollector
instance. It is useful when you want to transform
the current object to a ValidateErrorCollector
for further processing or
validation error handling.
§Returns
A ValidateErrorCollector
created by cloning and converting the current object.
Trait Implementations§
Source§impl Clone for ValidateErrorStore
impl Clone for ValidateErrorStore
Source§impl Debug for ValidateErrorStore
impl Debug for ValidateErrorStore
Source§impl Default for ValidateErrorStore
impl Default for ValidateErrorStore
Source§fn default() -> ValidateErrorStore
fn default() -> ValidateErrorStore
Source§impl Into<ValidateErrorCollector> for ValidateErrorStore
impl Into<ValidateErrorCollector> for ValidateErrorStore
Source§fn into(self) -> ValidateErrorCollector
fn into(self) -> ValidateErrorCollector
Source§impl Into<ValidateErrorStore> for &DateError
Available on crate feature chrono
only.
impl Into<ValidateErrorStore> for &DateError
chrono
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &DateTimeError
Available on crate feature chrono
only.
impl Into<ValidateErrorStore> for &DateTimeError
chrono
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &DateTimeError
Available on crate feature humantime
only.
impl Into<ValidateErrorStore> for &DateTimeError
humantime
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &DescriptionError
impl Into<ValidateErrorStore> for &DescriptionError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &EmailError
Available on crate feature email
only.
impl Into<ValidateErrorStore> for &EmailError
email
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &FloatError
impl Into<ValidateErrorStore> for &FloatError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &IntegerError
impl Into<ValidateErrorStore> for &IntegerError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &NaiveDateTimeError
Available on crate feature chrono
only.
impl Into<ValidateErrorStore> for &NaiveDateTimeError
chrono
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &NameError
impl Into<ValidateErrorStore> for &NameError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &PasswordError
impl Into<ValidateErrorStore> for &PasswordError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &TimeError
Available on crate feature chrono
only.
impl Into<ValidateErrorStore> for &TimeError
chrono
only.Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &UnsignedError
impl Into<ValidateErrorStore> for &UnsignedError
Source§fn into(self) -> ValidateErrorStore
fn into(self) -> ValidateErrorStore
Source§impl Into<ValidateErrorStore> for &UrlError
Available on crate feature url
only.
impl Into<ValidateErrorStore> for &UrlError
url
only.