1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
const std = @import("std");
const Self = @This();
pub const Kind = enum(u32) {
current = 1,
preferred = 2,
};
kind: Kind,
width: u32,
height: u32,
refresh: u32,
pub fn format(
self: *const Self,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = fmt;
_ = options;
const ghz: f32 = @as(f32, @floatFromInt(self.refresh)) / 1000.0;
try writer.print("{}x{}@{d:.2}", .{ self.width, self.height, ghz});
}
|