mirror of
https://codeberg.org/kaasboteram/zig-iterating.git
synced 2025-12-15 09:43:14 +01:00
Refactored out Clean
This commit is contained in:
parent
6122ca7b19
commit
2f02e13cc3
1 changed files with 2 additions and 10 deletions
12
src/root.zig
12
src/root.zig
|
|
@ -149,11 +149,11 @@ pub fn Iterator(comptime Inner: type) type {
|
|||
}.some);
|
||||
}
|
||||
|
||||
pub fn chain(self: Self, other: anytype) Iterator(adapters.Chain(Inner, Clean(@TypeOf(other)))) {
|
||||
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, Clean(@TypeOf(other)))) {
|
||||
pub fn zip(self: Self, other: anytype) Iterator(adapters.Zip(Inner, @TypeOf(other)._Inner)) {
|
||||
return .{ .inner = .{ .a = self.inner, .b = other.inner } };
|
||||
}
|
||||
|
||||
|
|
@ -175,14 +175,6 @@ pub fn Iterator(comptime Inner: type) type {
|
|||
};
|
||||
}
|
||||
|
||||
fn Clean(comptime It: type) type {
|
||||
if (@hasDecl(It, "_Inner")) {
|
||||
if (Iterator(It._Inner) == It) return It._Inner;
|
||||
}
|
||||
|
||||
return It;
|
||||
}
|
||||
|
||||
pub const adapters = struct {
|
||||
pub fn Map(
|
||||
comptime Inner: type,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue