diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-30 17:36:52 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-30 17:36:52 +0200 |
| commit | 5ecd48d4b9f928beb4143f88e802ee4d9e25a2bd (patch) | |
| tree | 6fd4944a8c81891046c7006336f46b808b56d08d /src/eval/Root.zig | |
| parent | 103efd52b59f77fbfde6a1b7daf65b16c2c26810 (diff) | |
refactor(element): supports more type in root append
Diffstat (limited to 'src/eval/Root.zig')
| -rw-r--r-- | src/eval/Root.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/eval/Root.zig b/src/eval/Root.zig index 1f2b61b..048dd3b 100644 --- a/src/eval/Root.zig +++ b/src/eval/Root.zig @@ -31,7 +31,13 @@ pub fn allocator(self: *Self) Allocator { return self.arena.allocator(); } -pub fn append(self: *Self, el: Element) void { +pub fn append(self: *Self, raw: anytype) void { + const el: Element = blk: { + const T = @TypeOf(raw); + if (T == Element) break :blk raw; + if (std.meta.hasMethod(T, "element")) break :blk raw.element(); + @compileError("cannot convert " ++ @typeName(T) ++ " into " ++ @typeName(Element)); + }; self.content.append(&el.node().node); } |
