diff options
| author | Maciej Walczak <14938807+xackus@users.noreply.github.com> | 2020-08-11 21:49:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-11 15:49:43 -0400 |
| commit | 6febe7e977072fea1bf7b6003be2d6c1f3654905 (patch) | |
| tree | 77c7d9bae1ec5ea2e7254eefba240f50f6904390 /lib/std/builtin.zig | |
| parent | 2b28cebf644b29543fcb52504b11931a7c797ffb (diff) | |
| download | zig-6febe7e977072fea1bf7b6003be2d6c1f3654905.tar.gz zig-6febe7e977072fea1bf7b6003be2d6c1f3654905.zip | |
copy_file_range linux syscall (#6010)
Diffstat (limited to 'lib/std/builtin.zig')
| -rw-r--r-- | lib/std/builtin.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index e9c53d7ee5..49edab1fd7 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -447,6 +447,14 @@ pub const Version = struct { if (self.max.order(ver) == .lt) return false; return true; } + + /// Checks if system is guaranteed to be at least `version` or older than `version`. + /// Returns `null` if a runtime check is required. + pub fn isAtLeast(self: Range, ver: Version) ?bool { + if (self.min.order(ver) != .lt) return true; + if (self.max.order(ver) == .lt) return false; + return null; + } }; pub fn order(lhs: Version, rhs: Version) std.math.Order { |
