Skip to main content

deserialize

Attribute Macro deserialize 

Source
#[deserialize]
Expand description

Emit an inline open() call, decoding a blob or reading from a file.

Available when the serialization feature is enabled. Re-exported as toolkit_zero::serialization::deserialize.

  • Variable modeblob_expr must be in scope; the function name becomes the binding name; the return type (required) is used as the turbofish type T in open::<T>(…). The function body is discarded.

    #[deserialize(blob)]  fn config() -> Config {}
    // expands to:  let config: Config = open::<Config>(&blob, None)?;
  • File read mode — triggered by path = "...". Reads the file first, then passes the bytes to open::<T>. Return type still required.

    #[deserialize(path = "config.bin")]  fn config() -> Config {}

Full documentation and examples are in the crate-level #[deserialize] section.