Skip to main content

SchemaDynamic

Trait SchemaDynamic 

Source
pub trait SchemaDynamic {
    const SERIALIZED_SIZE: SerializedSize = _;

    // Required method
    fn schema() -> RootSchema;
}
Expand description

Runtime schema metadata derived for a serializable type.

Provided Associated Constants§

Source

const SERIALIZED_SIZE: SerializedSize = _

Serialized-size information under wincode’s default configuration.

  • SerializedSize::Static means the entire encoding has a finite maximum. Its value is the maximum number of serialized bytes; individual enum variants may be smaller.
  • SerializedSize::Dynamic means a complete upper bound cannot be derived from wincode’s type metadata. Its value is the portion that can still be determined statically: the sum of fixed-size fields for a struct, or the tag plus the largest fixed-size portion of any enum variant.

This constant is sizing metadata; it does not impose or validate a serialization limit.

A #[wincode(with = ...)] adapter supplies the field’s serialized-size metadata, but the runtime RootSchema continues to describe the Rust field’s DynTy. Such an adapter must therefore preserve that field’s wire representation when the schema is used with Decoder.

Required Methods§

Source

fn schema() -> RootSchema

Generates the type’s serializable runtime schema.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§