AnyCursor

public 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 : Cursor>(_ base: C) where C.Element == Element
  • Creates a cursor that wraps the given closure in its next() method

    Declaration

    Swift

    public init(_ body: @escaping () throws -> Element?)
  • Advances to the next element and returns it, or nil if no next element exists.

    Declaration

    Swift

    public func next() throws -> Element?