Function extism_pdk::var::set

source ·
pub fn set(key: impl AsRef<str>, val: impl ToMemory) -> Result<(), Error>
Expand description

Set a variable in the plug-in. This variable lives as long as the plug-in is loaded. The value must have a ToMemory implementation.

§Arguments

  • key - A unique string key to identify the variable
  • val - The value to set. Must have a ToMemory implementation

§Examples

var::set("my_u32_var", 42u32)?;
var::set("my_str_var", "Hello, World!")?;