1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use std::collections::HashSet; use crate::json::JsValue; use crate::schema::SchemaNode; use super::Coercion; #[derive(Debug, Fail)] pub enum CoercionError { #[fail( display = "CoercionError::IncompatibleSchemas: {:?} -> {:?}", source, target )] IncompatibleSchemas { source: SchemaNode, target: SchemaNode, }, #[fail(display = "CoercionError::UnexpectedInput: {:?} {:?}", input, coercion)] UnexpectedInput { input: JsValue, coercion: Coercion }, #[fail(display = "CoercionError::ObjectFieldsMissing: {:?}", _0)] ObjectFieldsMissing(HashSet<String>), #[fail(display = "CoercionError::JsNumberError")] JsNumberError, }