MutableHierarchicalCollection
public protocol MutableHierarchicalCollection : HierarchicalCollection
MutableHierarchicalCollection extends HierarchicalCollection
s to allow mutation of contents.
While many algorithms simply query the data structure in order to do their work, some algorithms modify the data structure. This protocol abstracts over a set of common mutation operations of hierarchical data structures.
-
Swaps the contents of
lhs
andrhs
.Declaration
Swift
mutating func swapAt(_ lhs: Self.Cursor, _ rhs: Self.Cursor)
-
Applies
fn
to each element in the hierarchical collection.Declaration
Swift
mutating func forEachMut(_ fn: (inout Element) throws -> Void) rethrows