pub trait AirbenderCodec {
const VERSION: u32;
// Required methods
fn encode<T>(value: &T) -> Result<Vec<u8>, CodecError>
where T: Serialize;
fn decode<T>(bytes: &[u8]) -> Result<T, CodecError>
where T: DeserializeOwned;
}Expand description
A stable, versioned serializer used by Airbender host and guest programs.
Required Associated Constants§
Required Methods§
Sourcefn encode<T>(value: &T) -> Result<Vec<u8>, CodecError>where
T: Serialize,
fn encode<T>(value: &T) -> Result<Vec<u8>, CodecError>where
T: Serialize,
Serialize a value into a byte payload.
Sourcefn decode<T>(bytes: &[u8]) -> Result<T, CodecError>where
T: DeserializeOwned,
fn decode<T>(bytes: &[u8]) -> Result<T, CodecError>where
T: DeserializeOwned,
Deserialize a value from a byte payload.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.