#[non_exhaustive]pub enum ValueWireEncodeError {
JsonNumberNotRoundTrippable,
NonFiniteFloat {
data_type: DataType,
},
BigDecimalScaleTooLarge {
scale: i64,
maximum_absolute_scale: i64,
},
InstantYearOutOfRange {
year: i32,
},
Budget(BudgetError<JsonResource, usize>),
Quantity {
resource: JsonResource,
source: QuantityConversionError,
},
Syntax(JsonSyntaxError),
Json(JsonSerializationError),
Io(Error),
}Expand description
A runtime value cannot be represented by the JSON V1 wire contract.
§Examples
use qubit_value::Value;
use qubit_value::ValueWireEncodeError;
use qubit_value::ValueWireV1;
let error = ValueWireV1::try_from(Value::Float64(f64::NAN)).unwrap_err();
assert!(matches!(error, ValueWireEncodeError::NonFiniteFloat { .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
JsonNumberNotRoundTrippable
json only.A JSON number cannot be restored with the V1 number model without
changing its serde_json::Number identity.
NonFiniteFloat
A JSON V1 float must be finite.
BigDecimalScaleTooLarge
A V1 decimal exponent must stay within the bounded wire range.
Fields
InstantYearOutOfRange
A UTC instant year must be within the four-digit V1 wire range.
Budget(BudgetError<JsonResource, usize>)
json only.The JSON output exceeded one configured resource budget.
Tuple Fields
0: BudgetError<JsonResource, usize>Budget violation reported by the bounded JSON encoder.
Quantity
json only.A native JSON measurement could not be represented by the budget quantity type.
Fields
resource: JsonResourceResource whose measurement failed.
source: QuantityConversionErrorNative measurement conversion failure.
Syntax(JsonSyntaxError)
json only.The encoded value contains invalid JSON syntax.
Tuple Fields
0: JsonSyntaxErrorSyntax error found in an embedded raw JSON payload.
Json(JsonSerializationError)
json only.Strict JSON serialization rejected the value during bounded encoding.
Tuple Fields
0: JsonSerializationErrorStable, privacy-safe JSON serialization failure.
Io(Error)
json only.The destination writer rejected bounded JSON output.
Trait Implementations§
Source§impl Debug for ValueWireEncodeError
impl Debug for ValueWireEncodeError
Source§impl Display for ValueWireEncodeError
impl Display for ValueWireEncodeError
Source§impl Error for ValueWireEncodeError
impl Error for ValueWireEncodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<JsonEncodeError<JsonResource>> for ValueWireEncodeError
Available on crate feature json only.
impl From<JsonEncodeError<JsonResource>> for ValueWireEncodeError
json only.Source§fn from(error: JsonEncodeError<JsonResource>) -> Self
fn from(error: JsonEncodeError<JsonResource>) -> Self
Converts bounded JSON encoder failures into wire encoding errors.
Resource-budget failures retain their budget details, invalid raw JSON retains its syntax error, and serialization or writer failures retain their corresponding source errors.
§Parameters
error- Failure reported by the bounded JSON encoder.
§Returns
The wire encoding error corresponding to the encoder failure.
Source§impl From<MeasuredBudgetError<JsonResource, usize>> for ValueWireEncodeError
Available on crate feature json only.
impl From<MeasuredBudgetError<JsonResource, usize>> for ValueWireEncodeError
json only.Source§fn from(error: MeasuredBudgetError<JsonResource, usize>) -> Self
fn from(error: MeasuredBudgetError<JsonResource, usize>) -> Self
Converts a measured budget failure into its corresponding wire error.
Budget violations retain their budget details, while quantity conversion failures retain the affected resource and source error.
§Parameters
error- Measured failure reported by the budget layer.
§Returns
The wire encoding error corresponding to the measured failure.