update structure
This commit is contained in:
35
src/data.zig
35
src/data.zig
@@ -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 = &.{};
|
||||
|
||||
Reference in New Issue
Block a user