config: FontStyle.clone

This commit is contained in:
Mitchell Hashimoto
2024-04-06 10:28:57 -07:00
parent efb8146c28
commit 07a5dd0442

View File

@ -3248,6 +3248,14 @@ pub const FontStyle = union(enum) {
};
}
/// Deep copy of the struct. Required by Config.
pub fn clone(self: Self, alloc: Allocator) !Self {
return switch (self) {
.default, .false => self,
.name => |v| .{ .name = try alloc.dupeZ(u8, v) },
};
}
/// Used by Formatter
pub fn formatEntry(self: Self, formatter: anytype) !void {
switch (self) {