update structure

This commit is contained in:
2026-04-04 10:51:31 +02:00
parent 011f35313e
commit a22a5702fa

View File

@@ -1,25 +1,18 @@
const std = @import("std");
const Type = enum { ailment, recipe, ingredient };
const Node = struct { name: []const u8, description: []const u8 };
const Edge = struct { name: []const u8, left: usize, right: usize };
const NodeID = enum(u16) { sellery_juice };
const Container = struct {
nodes: std.ArrayList(Node),
edges: std.ArrayList(Edge),
fn init(allocator: std.mem.Allocator) Container {
return .{
.nodes = std.ArrayList(Node).init(allocator),
.edges = std.ArrayList(Edge).init(allocator),
};
}
fn deinit(self: *Container) void {
self.nodes.deinit();
self.edges.deinit();
}
const Node = struct {
name: []const u8,
description: []const u8,
type: Type,
};
fn createData(allocator: std.mem.Allocator) !void {
const container = try Container.init(allocator);
}
const Edge = struct {
name: []const u8,
source: NodeID,
dest: NodeID,
};
var nodes: []const Node = &.{};
var edges: []const Edge = &.{};