remove Iterator(Inner).collectInto

This commit is contained in:
Luuk Machielse 2025-12-10 16:22:30 +01:00
parent b9098aea59
commit 1e9bd2454e

View file

@ -200,16 +200,12 @@ pub fn Iterator(comptime Inner: type) type {
var list: std.ArrayList(Item) = try .initCapacity(allocator, self.sizeHint());
errdefer list.deinit(allocator);
try self.collectInto(&list, allocator);
while (self.next()) |item| {
try list.append(allocator, item);
}
return try list.toOwnedSlice(allocator);
}
pub fn collectInto(self: *Self, list: *std.ArrayList(Item), allocator: std.mem.Allocator) !void {
while (self.next()) |val| {
try list.append(allocator, val);
}
}
};
}