diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-30 17:56:55 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-30 17:56:55 +0200 |
| commit | a13df3ca580dc31544ef092d5d37e18089af3517 (patch) | |
| tree | cfcf8c1d8322ee8e97783e263105eac9f5c00f33 /src/eval/list.zig | |
| parent | 5ecd48d4b9f928beb4143f88e802ee4d9e25a2bd (diff) | |
refactor(element): generalize element creation
Diffstat (limited to 'src/eval/list.zig')
| -rw-r--r-- | src/eval/list.zig | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/eval/list.zig b/src/eval/list.zig index 160bde2..0b1306a 100644 --- a/src/eval/list.zig +++ b/src/eval/list.zig @@ -24,12 +24,7 @@ fn List(comptime tag: []const u8) type { } pub fn element(self: *Self) Element { - return .{ .ptr = self, .vtable = .{ .html = html, .node = getNode } }; - } - - fn getNode(context: *anyopaque) *Node { - const self: *Self = @ptrCast(@alignCast(context)); - return &self.node; + return Element.Wrapper(Self, html).init(self); } fn fromNode(context: *anyopaque) Element { @@ -37,8 +32,7 @@ fn List(comptime tag: []const u8) type { return self.element(); } - fn html(context: *anyopaque, alloc: Allocator) HTML.Error!HTML { - const self: *Self = @ptrCast(@alignCast(context)); + fn html(self: *Self, alloc: Allocator) HTML.Error!HTML { var el = try HTML.Content.init(alloc, tag); var root = try HTML.Root.init(alloc); el.content = root.element(); |
