pub struct ErrorWithMessage {
pub error: String,
pub message: String,
}Expand description
Error body with a message: { "error": "...", "message": "..." }.
The 415 body (VldHttpError::unsupported_media_type,
VldHttpError::unsupported_form_media_type).
Fields§
§error: String§message: StringImplementations§
Source§impl ErrorWithMessage
impl ErrorWithMessage
Sourcepub fn parse<__VldInputT: VldInput + ?Sized>(
input: &__VldInputT,
) -> Result<ErrorWithMessage, VldError>
pub fn parse<__VldInputT: VldInput + ?Sized>( input: &__VldInputT, ) -> Result<ErrorWithMessage, VldError>
Parse and validate input data into this struct.
Accepts any type implementing [VldInput]: JSON strings, file paths,
serde_json::Value, byte slices, etc.
Sourcepub fn parse_value(__vld_json: &Value) -> Result<ErrorWithMessage, VldError>
pub fn parse_value(__vld_json: &Value) -> Result<ErrorWithMessage, VldError>
Parse and validate directly from a serde_json::Value.
Source§impl ErrorWithMessage
impl ErrorWithMessage
Sourcepub fn validate<__VldT: Serialize>(instance: &__VldT) -> Result<(), VldError>
pub fn validate<__VldT: Serialize>(instance: &__VldT) -> Result<(), VldError>
Validate an existing Rust value that can be serialized to JSON.
The value is serialized via serde, then validated against the
schema under the fields’ serialize names (parse() reads
the deserialize names). Returns Ok(()) on success,
Err(VldError) with all issues on failure.
Trait Implementations§
Source§impl Clone for ErrorWithMessage
impl Clone for ErrorWithMessage
Source§impl Debug for ErrorWithMessage
impl Debug for ErrorWithMessage
Source§impl Serialize for ErrorWithMessage
impl Serialize for ErrorWithMessage
Source§impl VldParse for ErrorWithMessage
impl VldParse for ErrorWithMessage
Auto Trait Implementations§
impl Forget for ErrorWithMessage
impl Freeze for ErrorWithMessage
impl RefUnwindSafe for ErrorWithMessage
impl Send for ErrorWithMessage
impl Sync for ErrorWithMessage
impl Unpin for ErrorWithMessage
impl UnsafeUnpin for ErrorWithMessage
impl UnwindSafe for ErrorWithMessage
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