mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Delete Sequence methods from CommitIterator
Default implementations are available via standard library extensions on Sequence.
This commit is contained in:
parent
3db2f74ac4
commit
452979bd64
@ -67,33 +67,4 @@ public class CommitIterator: IteratorProtocol, Sequence {
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public func makeIterator() -> CommitIterator {
|
||||
return self
|
||||
}
|
||||
|
||||
public private(set) var underestimatedCount: Int = 0
|
||||
public func map<T>(_ transform: (Result<Commit, NSError>) throws -> T) rethrows -> [T] {
|
||||
var new: [T] = []
|
||||
for item in self {
|
||||
new += [try transform(item)]
|
||||
}
|
||||
return new
|
||||
}
|
||||
|
||||
public func filter(_ isIncluded: (Result<Commit, NSError>) throws -> Bool) rethrows -> [Result<Commit, NSError>] {
|
||||
var new: [Result<Commit, NSError>] = []
|
||||
for item in self {
|
||||
if try isIncluded(item) {
|
||||
new += [item]
|
||||
}
|
||||
}
|
||||
return new
|
||||
}
|
||||
|
||||
public func forEach(_ body: (Result<Commit, NSError>) throws -> Void) rethrows {
|
||||
for item in self {
|
||||
try body(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user