pub trait WipType: Sized {
// Required methods
fn type_expr() -> TypeExpr;
fn collect_declarations(declarations: &mut Vec<TypeDeclaration>);
fn encode(self) -> Result<Value, CodecError>;
fn decode(value: Value) -> Result<Self, CodecError>;
}Expand description
Converts one Rust application type to and from its protocol representation.
Implementations must describe the same shape accepted by WipType::decode
and produced by WipType::encode. Prefer deriving this trait for named
DTOs. Its declaration-collection method exists for generated interface code
and normally should not be called by applications.
Required Methods§
Sourcefn collect_declarations(declarations: &mut Vec<TypeDeclaration>)
fn collect_declarations(declarations: &mut Vec<TypeDeclaration>)
Adds named declarations reachable from this type to declarations.
Implementations must be cycle-safe and preserve declaration order.
Sourcefn encode(self) -> Result<Value, CodecError>
fn encode(self) -> Result<Value, CodecError>
Encodes this value into the transport-independent protocol value model.
Sourcefn decode(value: Value) -> Result<Self, CodecError>
fn decode(value: Value) -> Result<Self, CodecError>
Decodes a previously validated protocol value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".