Skip to main content

WipType

Trait WipType 

Source
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§

Source

fn type_expr() -> TypeExpr

Returns the protocol type expression for this Rust type.

Source

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.

Source

fn encode(self) -> Result<Value, CodecError>

Encodes this value into the transport-independent protocol value model.

Source

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".

Implementations on Foreign Types§

Source§

impl WipType for ()

Source§

impl WipType for String

Source§

impl WipType for bool

Source§

impl WipType for f32

Source§

impl WipType for f64

Source§

impl WipType for i8

Source§

impl WipType for i16

Source§

impl WipType for i32

Source§

impl WipType for i64

Source§

impl WipType for i128

Source§

impl WipType for isize

Source§

impl WipType for u8

Source§

impl WipType for u16

Source§

impl WipType for u32

Source§

impl WipType for u64

Source§

impl WipType for u128

Source§

impl WipType for usize

Source§

impl<T: WipType> WipType for Vec<T>

Implementors§