Skip to main content

check_api_version

Function check_api_version 

Source
pub const fn check_api_version(required: Version) -> Result<(), VersionError>
Expand description

Check if the current API version is compatible with the required version.

Returns Ok(()) if compatible, Err(VersionError) otherwise.

§Compatibility Rules (semver)

  • Major version must match exactly
  • Module can require an older minor version than kernel provides
  • Patch version is ignored for compatibility

§Errors

Returns Err(VersionError) if:

  • Major version mismatch (VersionErrorKind::MajorMismatch)
  • Required minor version is newer than provided (VersionErrorKind::MinorTooNew)

§Example

use reovim_kernel::api::v1::{check_api_version, Version};

// Check if kernel provides compatible API
let result = check_api_version(Version::new(0, 2, 0));
assert!(result.is_ok());