DVUI

format

Parameters

#
self:*const Mod
*const Mod
_:[]const u8
[]const u8
_:std.fmt.FormatOptions
std.fmt.FormatOptions
writer:anytype
anytype

Source

Implementation

#
pub fn format(self: *const Mod, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
        try writer.writeAll("Mod(");
        var needs_separator = false;

        if (self.* == .none) {
            try writer.writeAll("none");
        } else {
            const mod_fields = comptime std.meta.fieldNames(Mod);
            inline for (mod_fields[0..9]) |field_name| {
                if (self.has(@field(Mod, field_name))) {
                    if (needs_separator) try writer.writeAll(", ") else needs_separator = true;
                    try writer.writeAll(field_name);
                }
            }
        }

        try writer.writeAll(")");
    }