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 encoding macro can be used to create newtypes that implement a particular encoding for the inner value.

Structs

  • Base64 conversion
  • The Error type, a wrapper around a dynamic error type.
  • Json encoding
  • MemoryHandle describes where in memory a block of data is stored
  • Msgpack encoding
  • Protobuf encoding

Traits

  • FromBytes is used to define how a type should be decoded when working with Extism memory. It is used for plugin output and host function input.
  • FromBytesOwned is similar to FromBytes but it doesn’t borrow from the input slice. FromBytes is automatically implemented for all types that implement FromBytesOwned
  • ToBytes is used to define how a type should be encoded when working with Extism memory. It is used for plugin input and host function output.