I'm trying to get code like this to compile:
public struct AsyncIterator<Iterator: AsyncIteratorProtocol>: AsyncIteratorProtocol {
private var iterator: Iterator
init(wrapping iterator: Iterator) {
self.iterator = iterator
}
public mutating func next() async -> Iterator.Element? {
await iterator.next()
}
}
But I get:
error: call can throw, but it is not marked with 'try' and the error is not handled
await iterator.next()
I've tried adding where Iterator.Failure == Never
but I'm not sure what else to try. It feels like this should be possible.