Skip to main content

serialize

Attribute Macro serialize 

Source
#[serialize]
Expand description

Emit an inline seal() call, binding the result or writing it to a file.

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

  • Variable mode — the function name becomes the binding name; the return type annotation (required) becomes the type of the let binding. The function body is discarded.

    #[serialize(source, key = my_key)]  fn blob() -> Vec<u8> {}
    // expands to:  let blob: Vec<u8> = seal(&source, Some(my_key))?;
  • File write mode — triggered by path = "...". Emits fs::write(path, seal(…)?)?". The function name and return type are ignored.

    #[serialize(source, path = "out.bin")]  fn _() {}

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