#[non_exhaustive]pub struct Converted {
pub value: Value,
pub report: LossReport,
}Expand description
The result of a conversion: what the target release will accept, and what that cost.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: ValueThe converted document, ready to deserialize into the target release’s
model. Value::Null if the resource type does not exist in the target.
report: LossReportWhat was changed or discarded getting there.
Implementations§
Source§impl Converted
impl Converted
Sourcepub fn strict(self) -> Result<Value, LossReport>
pub fn strict(self) -> Result<Value, LossReport>
The converted document, or the report if anything was changed at all.
For callers who would rather refuse a document than transmit a lossy version of it — a reasonable default when the receiver is a clinical system and a dropped element is a dropped fact.
The bar is LossReport::is_lossless, not
LossReport::discarded_data: a RequiredMissing means the result
will not validate in the target, and a BindingChanged means a code
that was legal may not be, so neither is something a strict caller
should be handed silently. Both are rare in practice — across the
committed corpora they account for one document each per release pair,
against roughly half that convert cleanly — so this does not reject
everything.
§Errors
The LossReport, whenever the conversion was not lossless.