pub var currentCloneResult : ?CloneResult = null;
pub const CloneResult = union(enum) {
Ok: std.ArrayList(CloneEntry),
Error: std.ArrayList(CloneEntry),
};
pub const CloneEntry = union(enum) {
GameData: GDCE,
Language: LCE,
};
pub const GDCE = struct {
table: common.GameDataTableType,
oldId: u32,
newId: u32 = 0,
};
pub const LCE = struct {
table: common.langM.LanguageTableType,
oldId: u32,
newId: u32 = 0,
};
I trued this:
pub fn clone(cff: *common.CffData, gpa: std.mem.Allocator) void
{
if (currentCloneResult) |cr| {
switch (cr) {
.Ok => |ok| {
cloneImpl(cff, gpa, ok.items);
// I can not figure out a way, to get mutable acces here, to call deinit()
// TODO
// ok.deinit(gpa);
currentCloneResult = null;
},
else => unreachable
}
}
}