From 111e9dbe1fb323358454a6404d185d7a1115cd92 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 2 Feb 2026 21:31:33 +0100 Subject: [PATCH] refactor: add Buffer.Node.Ref type --- src/buffer/Buffer.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/buffer/Buffer.zig b/src/buffer/Buffer.zig index 12c1cbc..c36a6be 100644 --- a/src/buffer/Buffer.zig +++ b/src/buffer/Buffer.zig @@ -283,6 +283,12 @@ const Node = union(enum) { const walker = *const fn (ctx: *anyopaque, node: *const Node) WalkerMut; + pub const Ref = TypedInt.Tagged(usize, "NREF"); + + pub fn to_ref(self: *const Node) Node.Ref { + return @enumFromInt(@intFromPtr(self)); + } + fn new(allocator: Allocator, l: *const Node, r: *const Node) !*const Node { const node = try allocator.create(Node); errdefer allocator.destroy(node);