Crate extism_convert
source ·Expand description
The extism-convert crate is used by the Rust SDK and Rust PDK to provide a shared interface for encoding and decoding values that can be passed to Extism function calls.
A set of types (Json, Msgpack) that can be used to specify a serde encoding are also provided. These are similar to axum extractors - they are implemented as a tuple struct with a single field that is meant to be extracted using pattern matching.
Macros
- The
encodingmacro can be used to create newtypes that implement a particular encoding for the inner value.
Structs
- Base64 conversion
- The
Errortype, a wrapper around a dynamic error type. - Json encoding
MemoryHandledescribes where in memory a block of data is stored- Msgpack encoding
- Protobuf encoding
Traits
FromBytesis used to define how a type should be decoded when working with Extism memory. It is used for plugin output and host function input.FromBytesOwnedis similar toFromBytesbut it doesn’t borrow from the input slice.FromBytesis automatically implemented for all types that implementFromBytesOwnedToBytesis used to define how a type should be encoded when working with Extism memory. It is used for plugin input and host function output.