update: icons
This commit is contained in:
parent
cce0c6a954
commit
8fd9086d98
1 changed files with 6 additions and 1 deletions
|
|
@ -2,11 +2,13 @@ const std = @import("std");
|
|||
const Allocator = std.heap.ArenaAllocator;
|
||||
|
||||
const parser = @import("parser.zig");
|
||||
const icons = @import("svg/icons.zig");
|
||||
|
||||
pub const TemplateCache = struct {
|
||||
arena: Allocator,
|
||||
cache: std.StringHashMapUnmanaged([]parser.Node),
|
||||
default_path: ?[]const u8 = "templates",
|
||||
icons: ?icons.SvgIcon =null,
|
||||
|
||||
pub fn init(child_allocator: std.mem.Allocator) TemplateCache {
|
||||
const arena = std.heap.ArenaAllocator.init(child_allocator);
|
||||
|
|
@ -16,7 +18,6 @@ pub const TemplateCache = struct {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
pub fn deinit(self: *TemplateCache) void {
|
||||
self.arena.deinit();
|
||||
}
|
||||
|
|
@ -51,6 +52,10 @@ pub const TemplateCache = struct {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn initIcons(self: *TemplateCache) !void {
|
||||
self.icons = icons.SvgIcon.init(self.allocator()) catch null;
|
||||
}
|
||||
|
||||
pub fn clear(self: *TemplateCache) void {
|
||||
self.deinit();
|
||||
self.cache = .{};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue