separate permanentized data in workspace

This commit is contained in:
falsycat 2025-05-05 10:51:30 +09:00
parent 8263ccad82
commit e30773870f

View File

@ -3,20 +3,36 @@ const std = @import("std");
const CommandHistory = @import("./CommandHistory.zig"); const CommandHistory = @import("./CommandHistory.zig");
const TaskStore = @import("./TaskStore.zig"); const TaskStore = @import("./TaskStore.zig");
///
const Self = @This(); const Self = @This();
///
const Perma = struct {
tasks: TaskStore, tasks: TaskStore,
};
///
commands: CommandHistory, commands: CommandHistory,
///
perma: Perma,
///
pub fn init(allocator: std.mem.Allocator) Self { pub fn init(allocator: std.mem.Allocator) Self {
return Self { return Self {
.commands = CommandHistory.init(allocator), .commands = CommandHistory.init(allocator),
.perma = .{
.tasks = TaskStore.init(allocator), .tasks = TaskStore.init(allocator),
},
}; };
} }
///
pub fn deinit(self: *Self) void { pub fn deinit(self: *Self) void {
self.tasks.deinit(); self.perma.tasks.deinit();
self.commands.deinit();
} }
test { test {
var ws = init(std.testing.allocator); var ws = init(std.testing.allocator);
defer ws.deinit(); defer ws.deinit();