Macro extism_convert::encoding
source ยท macro_rules! encoding { ($pub:vis $name:ident, $to_vec:expr, $from_slice:expr) => { ... }; }
Expand description
The encoding
macro can be used to create newtypes that implement a particular encoding for the
inner value.
For example, the following line creates a new JSON encoding using serde_json:
extism_convert::encoding!(MyJson, serde_json::to_vec, serde_json::from_slice);
This will create a struct struct MyJson<T>(pub T)
and implement ToBytes
using serde_json::to_vec
and FromBytesOwned
using serde_json::from_slice