Skip to main content

Module value_bridge

Module value_bridge 

Source
Expand description

Bridge between serde_json::Value and Python objects.

For typed plugin calls, the host serialises arguments through serde_json::to_value (any Serialize type works) and we then convert the JSON tree into Python primitives. The reverse is symmetric: take a Python return value and turn it back into a serde_json::Value the host can serde_json::from_value::<O> into the expected return type.

JSON is the wire format because it’s the common ground between self-describing-serde-on-the-Rust-side and natural-Python-types-on-the- Python-side. The hot path for bulk data uses #[wire(raw)] (T-0082) which bypasses this layer entirely.

Functions§

pyobject_to_value
Convert a Python object back into a serde_json::Value.
value_to_pyobject
Convert a serde_json::Value into a Python object owned by py.