Module postcard::experimental

source ·
Expand description

§Experimental Postcard Features

Items inside this module require various feature flags, and are not subject to SemVer stability. Items may be removed or deprecated at any point.

§Derive

The experimental-derive feature enables two experimental features:

  • Max size calculation
  • Message schema generation

§Max Size Calculation

This features enables calculation of the Max serialized size of a message as an associated usize constant called POSTCARD_MAX_SIZE. It also provides a #[derive(MaxSize)] macro that can be used for calculating user types.

This is useful for determining the maximum buffer size needed when recieving or sending a message that has been serialized.

NOTE: This only covers the size of “plain” flavored messages, e.g. not with COBS or any other Flavors applied. The overhead for these flavors must be calculated separately.

Please report any missing types, or any incorrectly calculated values.

§Message Schema Generation

This feature enables the generation of a schema of a given message at compile time. At the moment, this is only exposed as a NamedType which is a recursive data structure describing the schema. In the future, it is planned to provide formatting functions that emit this as a human or machine readable schema.

NOTE: This only covers the schema of “plain” flavored messages, e.g. not with COBS or any other Flavors applied. The format of these flavors must be calculated separately.

Please report any missing types, or any incorrectly calculated schemas.

Modules§

  • Compile time max-serialization size calculation
  • Compile time Schema generation

Functions§