Skip to main content

PLUGIN_API_VERSION

Constant PLUGIN_API_VERSION 

Source
pub const PLUGIN_API_VERSION: u32 = 1;
Expand description

The version of this contract (the Rust traits) that this host implements. A host accepts a plugin only if the plugin’s PluginMetadata::api_version equals it (is_supported_api_version).

Every breaking change to the contract bumps it. It versions compile-time plugins (added with add_plugin or linked with export_plugin!); a runtime plugin is versioned by the ABI instead (abi::ABI_MAJOR, abi::ABI_MINOR). A marketplace listing of a Cargo crate names it as requires.plugin_api (see docs/design/marketplace.md).

use rich_plugin_api::{is_supported_api_version, PluginMetadata, PLUGIN_API_VERSION};

assert_eq!(PLUGIN_API_VERSION, 1);
let metadata = PluginMetadata::new("solarized", "Solarized themes", "1.0.0");
assert_eq!(metadata.api_version, PLUGIN_API_VERSION);
assert!(is_supported_api_version(metadata.api_version));