refactor: add Buffer.Node.Ref type

This commit is contained in:
CJ van den Berg 2026-02-02 21:31:33 +01:00
parent 7ab1480f29
commit 111e9dbe1f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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);