pub struct ErrorBody {
pub error: String,
}Expand description
Simple error body: { "error": "..." }.
Used for generic HTTP errors such as “Payload too large”, “Not Found”, “Method Not Allowed”, etc.
Fields§
§error: StringShort error title.
Implementations§
Source§impl ErrorBody
impl ErrorBody
Sourcepub fn parse<__VldInputT: VldInput + ?Sized>(
input: &__VldInputT,
) -> Result<ErrorBody, VldError>
pub fn parse<__VldInputT: VldInput + ?Sized>( input: &__VldInputT, ) -> Result<ErrorBody, 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<ErrorBody, VldError>
pub fn parse_value(__vld_json: &Value) -> Result<ErrorBody, VldError>
Parse and validate directly from a serde_json::Value.
Sourcepub fn vld_parse_value(__vld_json: &Value) -> Result<ErrorBody, VldError>
pub fn vld_parse_value(__vld_json: &Value) -> Result<ErrorBody, VldError>
Same as parse_value; callable as
T::vld_parse_value without importing vld::schema::VldParse.
Source§impl ErrorBody
impl ErrorBody
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§
Auto Trait Implementations§
impl Forget for ErrorBody
impl Freeze for ErrorBody
impl RefUnwindSafe for ErrorBody
impl Send for ErrorBody
impl Sync for ErrorBody
impl Unpin for ErrorBody
impl UnsafeUnpin for ErrorBody
impl UnwindSafe for ErrorBody
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