feat: remove toStr methods
This commit is contained in:
@@ -11,10 +11,6 @@ pub const CpuInfo = struct {
|
||||
cpu_name: []u8,
|
||||
cpu_cores: i32,
|
||||
cpu_max_freq: f64,
|
||||
|
||||
pub fn toStr(self: CpuInfo, buf: []u8) ![]u8 {
|
||||
return std.fmt.bufPrint(buf, "{s} ({}) @ {d:.2} GHz", .{ self.cpu_name, self.cpu_cores, self.cpu_max_freq });
|
||||
}
|
||||
};
|
||||
|
||||
/// Struct representing GPU informations
|
||||
@@ -22,10 +18,6 @@ pub const GpuInfo = struct {
|
||||
gpu_name: []u8,
|
||||
gpu_cores: i32,
|
||||
gpu_freq: f64,
|
||||
|
||||
pub fn toStr(self: GpuInfo, buf: []u8) ![]u8 {
|
||||
return std.fmt.bufPrint(buf, "{s} ({}) @ {d:.2} GHz", .{ self.gpu_name, self.gpu_cores, self.gpu_freq });
|
||||
}
|
||||
};
|
||||
|
||||
/// Struct representing RAM usage informations
|
||||
@@ -33,10 +25,6 @@ pub const RamInfo = struct {
|
||||
ram_size: f64,
|
||||
ram_usage: f64,
|
||||
ram_usage_percentage: u8,
|
||||
|
||||
pub fn toStr(self: RamInfo, buf: []u8) ![]u8 {
|
||||
return std.fmt.bufPrint(buf, "{d:.2} / {d:.2} GiB ({}%)", .{ self.ram_usage, self.ram_size, self.ram_usage_percentage });
|
||||
}
|
||||
};
|
||||
|
||||
/// Struct representing Swap usage informations
|
||||
@@ -44,10 +32,6 @@ pub const SwapInfo = struct {
|
||||
swap_size: f64,
|
||||
swap_usage: f64,
|
||||
swap_usage_percentage: u64,
|
||||
|
||||
pub fn toStr(self: SwapInfo, buf: []u8) ![]u8 {
|
||||
return std.fmt.bufPrint(buf, "{d:.2} / {d:.2} GiB ({}%)", .{ self.swap_usage, self.swap_size, self.swap_usage_percentage });
|
||||
}
|
||||
};
|
||||
|
||||
/// Struct representing Disk usage informations
|
||||
@@ -56,10 +40,6 @@ pub const DiskInfo = struct {
|
||||
disk_size: f64,
|
||||
disk_usage: f64,
|
||||
disk_usage_percentage: u8,
|
||||
|
||||
pub fn toStr(self: DiskInfo, buf: []u8) ![]u8 {
|
||||
return std.fmt.bufPrint(buf, "({s}): {d:.2} / {d:.2} GB ({}%)", .{ self.disk_path, self.disk_usage, self.disk_size, self.disk_usage_percentage });
|
||||
}
|
||||
};
|
||||
|
||||
pub fn getCpuInfo(allocator: std.mem.Allocator) !CpuInfo {
|
||||
|
||||
Reference in New Issue
Block a user