pub const Range = struct min: WindowsVersionmax: WindowsVersionpub inline fn includesVersion(range: Range, ver: WindowsVersion) boolpub inline fn isAtLeast(range: Range, min_ver: WindowsVersion) ?bool296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312 pub const Range = struct {
min: WindowsVersion,
max: WindowsVersion,
pub inline fn includesVersion(range: Range, ver: WindowsVersion) bool {
return @backingInt(ver) >= @backingInt(range.min) and
@backingInt(ver) <= @backingInt(range.max);
}
/// Checks if system is guaranteed to be at least `version` or older than `version`.
/// Returns `null` if a runtime check is required.
pub inline fn isAtLeast(range: Range, min_ver: WindowsVersion) ?bool {
if (@backingInt(range.min) >= @backingInt(min_ver)) return true;
if (@backingInt(range.max) < @backingInt(min_ver)) return false;
return null;
}
}