LeafArray
public struct LeafArray<Element> : HierarchicalCollection
LeafArray wraps an Array
to form a HierarchicalCollection
.
LeafArray is a “bottom” type within a HierarchicalCollection.
-
Declaration
Swift
public typealias Cursor = Int
-
Wrap
array
to form aHierarchicalCollection
.Declaration
Swift
public init(_ array: [Element])
-
Wrap
elements
to form aHierarchicalCollection
.Declaration
Swift
public init(_ elements: Element...)
-
Declaration
Swift
@discardableResult public func forEachWhile(startingAt cursor: Int? = nil, _ fn: (Element) throws -> Bool) rethrows -> Cursor?
-
Declaration
Swift
public func flatten() -> [Element]
-
Declaration
Swift
public func flatten<T: RangeReplaceableCollection>(into collection: inout T) where T.Element == Element
-
Declaration
Swift
public func mapAndFlatten<T>(_ fn: (Element) throws -> T) rethrows -> [T]
-
Declaration
Swift
public func compactMapAndFlatten<T>(_ fn: (Element) throws -> T?) rethrows -> [T]
-
Declaration
Swift
public var count: Int { get }