pub enum Runtime {
Ae = 1,
Se = 2,
Vr = 4,
}
Expand description
Defines Skyrim runtime versions.
Variants§
Ae = 1
The Skyrim runtime is a post-Anniversary Edition Skyrim SE release (version 1.6.x and later).
Se = 2
The Skyrim runtime is a pre-Anniversary Edition Skyrim SE release (version 1.5.97 and prior).
Vr = 4
The Skyrim runtime is Skyrim VR.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub const fn from_version(version: &Version) -> Self
pub const fn from_version(version: &Version) -> Self
Get the runtime from version.
This function takes a Version
object and returns the corresponding Runtime
variant.
The runtime is determined based on the version’s minor
numbers:
minor
4 ->Runtime::Vr
(Skyrim VR)minor
6 ->Runtime::Ae
(Skyrim Anniversary Edition)- Any other version is considered
Runtime::Se
(Skyrim Special Edition).
If you want strictness, use Runtime::from_version_strict
.
§Example
use commonlibsse_ng::rel::module::Runtime;
use commonlibsse_ng::rel::version::Version;
let version = Version::new(1, 5, 50, 0); // SE version
let runtime = Runtime::from_version(&version);
assert_eq!(runtime, Runtime::Se);
let version = Version::new(1, 6, 317, 0); // AE version
let runtime = Runtime::from_version(&version);
assert_eq!(runtime, Runtime::Ae);
§Laxity of judgment.
This judgment is incorrectly determined to be Vr if the SE is 1.4.2.
This method is useful under the following assumptions
- SE users are using the latest (1.5.97).
- The version update of this library has not caught up with the version of Skyrim, even though the version of Skyrim has been upgraded.
Sourcepub const fn from_version_strict(version: &Version) -> Option<Self>
pub const fn from_version_strict(version: &Version) -> Option<Self>
Get the runtime from version, strictly matching predefined database versions.
This function will only return a runtime if the version matches exactly one of the predefined versions in the database.
§Example
use commonlibsse_ng::rel::module::Runtime;
use commonlibsse_ng::rel::version::Version;
use commonlibsse_ng::skse::version::{RUNTIME_SSE_1_5_50, RUNTIME_SSE_1_6_317, RUNTIME_VR_1_4_15};
// SE version within range
let runtime = Runtime::from_version_strict(&RUNTIME_SSE_1_5_50);
assert_eq!(runtime, Some(Runtime::Se));
// AE version within range
let runtime = Runtime::from_version_strict(&RUNTIME_SSE_1_6_317);
assert_eq!(runtime, Some(Runtime::Ae));
// VR version
let runtime = Runtime::from_version_strict(&RUNTIME_VR_1_4_15);
assert_eq!(runtime, Some(Runtime::Vr));