pub fn create_plugin_with_required_version<T: WSLPluginV1>(
api: &'static WSLPluginAPIV1,
required_major: u32,
required_minor: u32,
required_revision: u32,
) -> Result<T>Expand description
Creates a WSL plugin instance with a specified required API version.
This function ensures that the provided WSL Plugin API meets the required version before creating a new plugin instance. If the API version does not meet the requirements, an error is returned.
§Type Parameters
T: A type implementing theWSLPluginV1trait, representing the plugin to create.
§Arguments
api: A reference to the WSL Plugin API version 1 structure.required_major: The required major version of the API.required_minor: The required minor version of the API.required_revision: The required revision of the API.
§Returns
Ok(plugin): The created plugin instance.Err(WinError): If the API version is insufficient or the plugin is already initialized.
§Errors
- Returns
WinError::from([ERROR_ALREADY_INITIALIZED])if a plugin is already initialized. - Returns
WinError::from(WSL_E_PLUGIN_REQUIRES_UPDATE)error if the API version is insufficient.