This crates contains common serialization and deserialization methods for communicating in and out of waPC modules.
waPC does not require MessagePack but it does require a communication contract between hosts and guests. The waPC CLI code generator uses this crate but you are free to use what you want.
The following is a simple example of synchronous, bi-directional procedure calls between a WebAssembly host runtime and the guest module.
```rust use serde::{Deserialize, Serialize}; use wapc_codec::messagepack::{deserialize, serialize};
struct Person { firstname: String, lastname: String, age: u8, }
pub fn main() -> Result<(), Box
println!("Original : {:?}", person);
let bytes = serialize(&person)?;
println!("Serialized messagepack bytes: {:?}", bytes);
let round_trip: Person = deserialize(&bytes)?;
println!("Deserialized : {:?}", round_trip);
Ok(()) } ```