pub enum AbiResult {
Ok(Value),
Error(PluginError),
}Expand description
JSON envelope wrapping the outcome of a fallible plugin ABI call.
The low-level Wasm exports (validate, calculate_metrics,
generate_passport) cannot return a Rust Result across the C ABI, so the
outcome is serialised as this externally-tagged enum. On success, ok
carries the method’s return value (a PluginResult for
calculate_metrics, the normalised payload for generate_passport, or
null for validate). On failure, error carries a structured
PluginError. The host deserialises this to recover the typed result.
{ "ok": { "co2eScore": 85.4, "complianceStatus": "NOT_ASSESSED", ... } }
{ "error": { "ValidationErrors": [ { "field": "/gtin", "code": "missing", ... } ] } }Variants§
Ok(Value)
Error(PluginError)
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AbiResult
impl<'de> Deserialize<'de> for AbiResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AbiResult
impl RefUnwindSafe for AbiResult
impl Send for AbiResult
impl Sync for AbiResult
impl Unpin for AbiResult
impl UnsafeUnpin for AbiResult
impl UnwindSafe for AbiResult
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