AnyCursor

public final class AnyCursor<Element> : Cursor

A type-erased cursor of Element.

This cursor forwards its next() method to an arbitrary underlying cursor having the same Element type, hiding the specifics of the underlying cursor.

  • Creates a cursor that wraps a base cursor but whose type depends only on the base cursor’s element type

    Declaration

    Swift

    public init<C>(_ base: C) where Element == C.Element, C : Cursor
  • Creates a cursor that wraps a base iterator but whose type depends only on the base iterator’s element type

    Declaration

    Swift

    public convenience init<I>(iterator: I) where Element == I.Element, I : IteratorProtocol
  • Creates a cursor that wraps a base sequence but whose type depends only on the base sequence’s element type

    Declaration

    Swift

    public convenience init<S>(_ s: S) where Element == S.Element, S : Sequence
  • Creates a cursor that wraps the given closure in its next() method

    Declaration

    Swift

    public init(_ body: @escaping () throws -> Element?)