From 1a671a92ac2be9f9f6f2c4f60747e83c90826859 Mon Sep 17 00:00:00 2001 From: Luuk Machielse Date: Mon, 8 Dec 2025 09:05:51 +0100 Subject: [PATCH] Remove `Iterator(Inner)._Inner` --- src/root.zig | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/root.zig b/src/root.zig index 6f2cff8..aa1914b 100644 --- a/src/root.zig +++ b/src/root.zig @@ -10,7 +10,7 @@ pub fn iter(comptime T: type) type { test fromSlice { const expectEqual = std.testing.expectEqual; - var it = iter(i32).fromSliceOwned(&.{ 1, 3, 2, 4 }); + var it = iter(i32).fromSlice(&.{ 1, 3, 2, 4 }); try expectEqual(1, it.next()); try expectEqual(3, it.next()); @@ -83,8 +83,6 @@ pub fn Iterator(comptime Inner: type) type { .reset = @hasDecl(Inner, "reset"), }; - const _Inner = Inner; - const Self = @This(); pub fn next(self: *Self) ?Item { @@ -179,19 +177,19 @@ pub fn Iterator(comptime Inner: type) type { }.some); } - pub fn chain(self: Self, other: anytype) Iterator(adapters.Chain(Inner, @TypeOf(other)._Inner)) { + pub fn chain(self: Self, other: anytype) Iterator(adapters.Chain(Inner, @TypeOf(other.inner))) { return .{ .inner = .{ .first = self.inner, .second = other.inner } }; } - pub fn zip(self: Self, other: anytype) Iterator(adapters.Zip(Inner, @TypeOf(other)._Inner)) { + pub fn zip(self: Self, other: anytype) Iterator(adapters.Zip(Inner, @TypeOf(other.inner))) { return .{ .inner = .{ .a = self.inner, .b = other.inner } }; } test zip { const expectEqualDeep = std.testing.expectEqualDeep; - var it = iter(i32).fromSliceOwned(&.{ 1, 2, 3 }) - .zip(iter(i32).fromSliceOwned(&.{ 4, 5, 6 })); + var it = iter(i32).fromSlice(&.{ 1, 2, 3 }) + .zip(iter(i32).fromSlice(&.{ 4, 5, 6 })); try expectEqualDeep(.{ 1, 4 }, it.next()); try expectEqualDeep(.{ 2, 5 }, it.next());