pub struct ValidationErrors(pub Vec<VlorQLError>);Expand description
A collection of validation errors returned after validating a whole request.
Use ValidationErrors::validate to convert an iterator of
VlorQLError into Result<(), Self>. The vector can be
inspected via ValidationErrors::as_slice.
§Examples
use vlorql_core::errors::{VlorQLError, ValidationErrorKind, ValidationErrors};
use serde_json::json;
let errors = ValidationErrors::new(vec![
VlorQLError::validation(
ValidationErrorKind::InvalidJson,
json!({"response": "bad"}),
),
]);
assert_eq!(errors.len(), 1);
assert!(!errors.is_empty());Tuple Fields§
§0: Vec<VlorQLError>Implementations§
Source§impl ValidationErrors
impl ValidationErrors
Sourcepub fn new<I>(errors: I) -> Selfwhere
I: IntoIterator<Item = VlorQLError>,
pub fn new<I>(errors: I) -> Selfwhere
I: IntoIterator<Item = VlorQLError>,
Creates an error collection from an iterator.
Sourcepub fn validate<I>(errors: I) -> Result<(), Self>where
I: IntoIterator<Item = VlorQLError>,
pub fn validate<I>(errors: I) -> Result<(), Self>where
I: IntoIterator<Item = VlorQLError>,
Validates a collection of errors, returning Ok(()) when there are none.
Sourcepub fn as_slice(&self) -> &[VlorQLError]
pub fn as_slice(&self) -> &[VlorQLError]
Returns the collected errors as a slice.
Sourcepub fn into_inner(self) -> Vec<VlorQLError>
pub fn into_inner(self) -> Vec<VlorQLError>
Consumes the collection and returns its errors.
Trait Implementations§
Source§impl Clone for ValidationErrors
impl Clone for ValidationErrors
Source§impl Debug for ValidationErrors
impl Debug for ValidationErrors
Source§impl<'de> Deserialize<'de> for ValidationErrors
impl<'de> Deserialize<'de> for ValidationErrors
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 Display for ValidationErrors
impl Display for ValidationErrors
Source§impl Error for ValidationErrors
impl Error for ValidationErrors
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Vec<VlorQLError>> for ValidationErrors
impl From<Vec<VlorQLError>> for ValidationErrors
Source§fn from(errors: Vec<VlorQLError>) -> Self
fn from(errors: Vec<VlorQLError>) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ValidationErrors
impl PartialEq for ValidationErrors
Source§impl Serialize for ValidationErrors
impl Serialize for ValidationErrors
impl StructuralPartialEq for ValidationErrors
Auto Trait Implementations§
impl Forget for ValidationErrors
impl Freeze for ValidationErrors
impl Move for ValidationErrors
impl RefUnwindSafe for ValidationErrors
impl Send for ValidationErrors
impl Sync for ValidationErrors
impl Unpin for ValidationErrors
impl UnsafeUnpin for ValidationErrors
impl UnwindSafe for ValidationErrors
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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::Request