extism_convert/
lib.rs

1//! The [extism-convert](https://crates.io/crates/extism-convert) crate is used by the [Rust SDK](https://crates.io/crates/extism) and [Rust PDK](https://crates.io/crates/extism-pdk) to provide a shared interface for
2//! encoding and decoding values that can be passed to Extism function calls.
3//!
4//! A set of types (Json, Msgpack) that can be used to specify a serde encoding are also provided. These are
5//! similar to [axum extractors](https://docs.rs/axum/latest/axum/extract/index.html#intro) - they are
6//! implemented as a tuple struct with a single field that is meant to be extracted using pattern matching.
7
8// Makes proc-macros able to resolve `::extism_convert` correctly
9extern crate self as extism_convert;
10
11pub use anyhow::Error;
12
13mod encoding;
14
15mod from_bytes;
16mod memory_handle;
17mod to_bytes;
18
19pub use encoding::{Base64, Json};
20
21#[cfg(feature = "msgpack")]
22pub use encoding::Msgpack;
23
24#[cfg(feature = "prost")]
25pub use encoding::Prost;
26
27#[cfg(feature = "protobuf")]
28pub use encoding::Protobuf;
29
30#[cfg(all(feature = "raw", target_endian = "little"))]
31pub use encoding::Raw;
32
33pub use from_bytes::{FromBytes, FromBytesOwned};
34pub use memory_handle::MemoryHandle;
35pub use to_bytes::ToBytes;
36
37#[cfg(test)]
38mod tests;