tiny.smg.command.scan.counts
Defined in command.scan.
API (3)
Actions
Public operations.
Source
Source: tools/smg/src/command/scan/counts.zig
zig
const std = @import("std");const smg = @import("../../root.zig");const scan = smg.scan;pub fn parts(allocator: std.mem.Allocator, count_items: []const scan.Count) ![]const u8 { const sorted_items = try sorted(allocator, count_items); var out: std.Io.Writer.Allocating = .init(allocator); for (sorted_items, 0..) |item, index| { if (index != 0) try out.writer.writeAll(", "); try out.writer.print("{d} {s}", .{ item.count, item.name }); } return try out.toOwnedSlice();}pub fn sorted(allocator: std.mem.Allocator, count_items: []const scan.Count) ![]const scan.Count { const sorted_items = try allocator.dupe(scan.Count, count_items); std.mem.sort(scan.Count, sorted_items, {}, less); return sorted_items;}pub fn less(_: void, a: scan.Count, b: scan.Count) bool { return std.mem.lessThan(u8, a.name, b.name);}Source: tools/smg/src/command/scan/root.zig:4
zig
pub const counts = @import("counts.zig");Audit
| Definitions | 4 |
|---|---|
| Public names | 4 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |