Function extism_pdk::config::get

source ·
pub fn get(key: impl AsRef<str>) -> Result<Option<String>, Error>
Expand description

Gets a config item passed in from the host. This item is read-only and static throughout the lifetime of the plug-in.

§Arguments

  • key - A unique string key to identify the variable

§Examples

// let's assume we have a config object: { my_config: 42u32 }
// which is a u32. We can default to 0 first time we fetch it if it's not present
let my_config = config::get("my_config")?.unwrap_or(0u32);