From 141c3939bf9e792e6add1aaa8faddf007c36dc7f Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Tue, 6 Dec 2022 18:41:04 -0800 Subject: [PATCH] [DocC] Add documentation bundles for all three targets --- .gitignore | 1 + .../Collections.docc/Collections.md | 34 +++++ .../Collections.docc/Extensions/Deque.md | 67 +++++++++ .../Extensions/OrderedDictionary.Elements.md | 40 ++++++ .../Extensions/OrderedDictionary.Values.md | 27 ++++ .../Extensions/OrderedDictionary.md | 97 +++++++++++++ .../Extensions/OrderedSet.UnorderedView.md | 56 ++++++++ .../Collections.docc/Extensions/OrderedSet.md | 136 ++++++++++++++++++ .../DequeModule.docc/DequeModule.md | 3 + .../DequeModule.docc/Extensions/Deque.md | 64 +++++++++ .../Extensions/OrderedDictionary.Elements.md | 37 +++++ .../Extensions/OrderedDictionary.Values.md | 24 ++++ .../Extensions/OrderedDictionary.md | 94 ++++++++++++ .../Extensions/OrderedSet.UnorderedView.md | 53 +++++++ .../Extensions/OrderedSet.md | 133 +++++++++++++++++ .../OrderedCollections.md | 10 ++ Utils/generate-docs.sh | 92 ++++++++++++ 17 files changed, 968 insertions(+) create mode 100644 Sources/Collections/Collections.docc/Collections.md create mode 100644 Sources/Collections/Collections.docc/Extensions/Deque.md create mode 100644 Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Elements.md create mode 100644 Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Values.md create mode 100644 Sources/Collections/Collections.docc/Extensions/OrderedDictionary.md create mode 100644 Sources/Collections/Collections.docc/Extensions/OrderedSet.UnorderedView.md create mode 100644 Sources/Collections/Collections.docc/Extensions/OrderedSet.md create mode 100644 Sources/DequeModule/DequeModule.docc/DequeModule.md create mode 100644 Sources/DequeModule/DequeModule.docc/Extensions/Deque.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Elements.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Values.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md create mode 100644 Sources/OrderedCollections/OrderedCollections.docc/OrderedCollections.md create mode 100755 Utils/generate-docs.sh diff --git a/.gitignore b/.gitignore index f0e519a2..397ae000 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ xcuserdata/ .*.sw? /Benchmarks/.swiftpm /Benchmarks/.build +.docc-build diff --git a/Sources/Collections/Collections.docc/Collections.md b/Sources/Collections/Collections.docc/Collections.md new file mode 100644 index 00000000..7a0322c5 --- /dev/null +++ b/Sources/Collections/Collections.docc/Collections.md @@ -0,0 +1,34 @@ +# ``Collections`` + +**Swift Collections** is an open-source package of data structure implementations for the Swift programming language. + +This package provides separate modules for each group of data structures it implements. For instance, if you only need a double-ended queue type, you can pull in only that by importing `DequeModule`. + +The top-level module `Collections` imports and reexports each of these smaller packages. Importing this module is a useful shortcut if you want to import all data structures, or if you don't care about bringing in more code than you need. + +```swift +import Collections + +var deque: Deque = ["Ted", "Rebecca"] +deque.prepend("Keeley") + +let people = OrderedSet(deque) +people.contains("Rebecca") // true +``` + +#### Additional Resources + +- [`Swift Collections` on GitHub](https://github.com/apple/swift-collections/) +- [`Swift Collections` on the Swift Forums](https://forums.swift.org/c/related-projects/collections/72) + + +## Topics + +### Deque Module + +- ``Deque`` + +### Ordered Collections + +- ``OrderedSet`` +- ``OrderedDictionary`` diff --git a/Sources/Collections/Collections.docc/Extensions/Deque.md b/Sources/Collections/Collections.docc/Extensions/Deque.md new file mode 100644 index 00000000..c65ac432 --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/Deque.md @@ -0,0 +1,67 @@ +# ``Collections/Deque`` + + + + +## Topics + +### Creating a Deque + +- ``init()`` +- ``init(_:)-8tyaw`` +- ``init(_:)-1tqf4`` +- ``init(minimumCapacity:)`` +- ``init(repeating:count:)-4v1gt`` +- ``init(unsafeUninitializedCapacity:initializingWith:)`` + +### Inspecting a Deque + +- ``count-8wcnm`` +- ``isEmpty`` + +### Manipulating Elements at the Front + +- ``first`` +- ``prepend(_:)`` +- ``prepend(contentsOf:)-96y15`` +- ``prepend(contentsOf:)-51zn6`` +- ``removeFirst()-1vdmt`` +- ``removeFirst(_:)-2vuji`` +- ``popFirst()`` +- ``prefix(_:)`` + +### Manipulating Elements at the End + +- ``last`` +- ``append(_:)-9h4m7`` +- ``append(contentsOf:)-8rqnl`` +- ``append(contentsOf:)-29aoh`` +- ``removeLast()`` +- ``removeLast(_:)`` +- ``popLast()`` +- ``suffix(_:)`` + +### Manipulating Elements Elsewhere + +- ``subscript(_:)-9nk44`` +- ``subscript(_:)-6ee8i`` +- ``subscript(_:)-1klky`` +- ``subscript(_:)-ejld`` +- ``insert(_:at:)-9hsp7`` +- ``insert(contentsOf:at:)-1d60f`` +- ``replaceSubrange(_:with:)-5rtzd`` +- ``remove(at:)-3imgi`` + +### Reordering Elements + +- ``swapAt(_:_:)-7910s`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)-90y0t`` + +### Memory Management + +- ``reserveCapacity(_:)`` diff --git a/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Elements.md b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Elements.md new file mode 100644 index 00000000..8e77d426 --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Elements.md @@ -0,0 +1,40 @@ +# ``Collections/OrderedDictionary/Elements-swift.struct`` + + + + +## Topics + +### Inspecting an Elements View + +- ``isEmpty`` +- ``count`` + +### Accessing Elements + +- ``subscript(_:)-4xwc2`` +- ``keys`` +- ``values`` +- ``index(forKey:)`` + +### Removing Elements + +- ``remove(at:)`` +- ``removeSubrange(_:)-5x7oo`` +- ``removeSubrange(_:)-7wdak`` +- ``removeAll(keepingCapacity:)`` +- ``removeAll(where:)`` +- ``removeFirst()`` +- ``removeFirst(_:)`` +- ``removeLast()`` +- ``removeLast(_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``reverse()`` +- ``sort()`` +- ``sort(by:)`` +- ``partition(by:)`` +- ``shuffle()`` +- ``shuffle(using:)`` diff --git a/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Values.md b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Values.md new file mode 100644 index 00000000..3ef31e8b --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.Values.md @@ -0,0 +1,27 @@ +# ``Collections/OrderedDictionary/Values-swift.struct`` + + + + +## Topics + +### Inspecting a Values Collection + +- ``isEmpty`` +- ``count`` + +### Accessing Elements + +- ``subscript(_:)-25vfz`` +- ``elements`` +- ``withUnsafeBufferPointer(_:)`` +- ``withUnsafeMutableBufferPointer(_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)-77eiy`` +- ``partition(by:)-9x0i5`` +- ``sort()`` +- ``sort(by:)`` +- ``shuffle()`` +- ``shuffle(using:)`` diff --git a/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.md b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.md new file mode 100644 index 00000000..1db1199d --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/OrderedDictionary.md @@ -0,0 +1,97 @@ +# ``Collections/OrderedDictionary`` + + + + +## Topics + +### Creating a Dictionary + +- ``init()`` +- ``init(minimumCapacity:persistent:)`` +- ``init(uniqueKeysWithValues:)-5ux9r`` +- ``init(uniqueKeysWithValues:)-88mzi`` +- ``init(uncheckedUniqueKeysWithValues:)-6gxhj`` +- ``init(uncheckedUniqueKeysWithValues:)-2j0dw`` +- ``init(uncheckedUniqueKeysWithValues:)-6gxhj`` +- ``init(uniqueKeys:values:)`` +- ``init(uncheckedUniqueKeys:values:)`` +- ``init(_:uniquingKeysWith:)-2y39b`` +- ``init(_:uniquingKeysWith:)-zhfp`` +- ``init(grouping:by:)-6mahw`` +- ``init(grouping:by:)-6m2zw`` + +### Inspecting a Dictionary + +- ``isEmpty`` +- ``count`` + +### Accessing Keys and Values + +- ``subscript(_:)`` +- ``subscript(_:default:)`` +- ``index(forKey:)`` + +### Collection Views + +- ``keys`` +- ``values-swift.property`` +- ``elements-swift.property`` + +### Updating Values + +- ``updateValue(_:forKey:)`` +- ``updateValue(_:forKey:insertingAt:)`` +- ``updateValue(forKey:default:with:)`` +- ``updateValue(forKey:insertingDefault:at:with:)`` + +### Removing Keys and Values + +- ``removeValue(forKey:)`` +- ``remove(at:)`` +- ``filter(_:)`` +- ``removeAll(where:)`` +- ``removeAll(keepingCapacity:)`` +- ``removeFirst()`` +- ``removeLast()`` +- ``removeFirst(_:)`` +- ``removeLast(_:)`` +- ``removeSubrange(_:)-512n3`` +- ``removeSubrange(_:)-8rmzx`` + +### Combining Dictionaries + +- ``merge(_:uniquingKeysWith:)-6ka2i`` +- ``merge(_:uniquingKeysWith:)-9wkad`` +- ``merging(_:uniquingKeysWith:)-4z49c`` +- ``merging(_:uniquingKeysWith:)-2e0xa`` + +### Comparing Dictionaries + +- ``==(_:_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``reverse()`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)`` + +### Transforming a Dictionary + +- ``mapValues(_:)`` +- ``compactMapValues(_:)`` + +### Memory Management + +- ``reserveCapacity(_:)`` + +### Supporting Types + +- ``Index`` +- ``Values-swift.struct`` +- ``Elements-swift.struct`` diff --git a/Sources/Collections/Collections.docc/Extensions/OrderedSet.UnorderedView.md b/Sources/Collections/Collections.docc/Extensions/OrderedSet.UnorderedView.md new file mode 100644 index 00000000..6e2681dc --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/OrderedSet.UnorderedView.md @@ -0,0 +1,56 @@ +# ``Collections/OrderedSet/UnorderedView`` + + + + +## Topics + +### Binary Set Operations + +- ``intersection(_:)-3q45l`` +- ``intersection(_:)-6ee3o`` + +- ``union(_:)-79uk3`` +- ``union(_:)-23dm1`` + +- ``subtracting(_:)-3ct1b`` +- ``subtracting(_:)-8e6mw`` + +- ``symmetricDifference(_:)-6aed7`` +- ``symmetricDifference(_:)-7r79p`` + +- ``formIntersection(_:)-4ow38`` +- ``formIntersection(_:)-80iht`` + +- ``formUnion(_:)-6ijb`` +- ``formUnion(_:)-8tuol`` + +- ``subtract(_:)-627eq`` +- ``subtract(_:)-4pjhu`` + +- ``formSymmetricDifference(_:)-8pkt5`` +- ``formSymmetricDifference(_:)-75z52`` + +### Binary Set Predicates + +- ``==(_:_:)`` + +- ``isSubset(of:)-2dx31`` +- ``isSubset(of:)-801lo`` +- ``isSubset(of:)-952h5`` + +- ``isSuperset(of:)-9t33p`` +- ``isSuperset(of:)-2vtig`` +- ``isSuperset(of:)-9krpz`` + +- ``isStrictSubset(of:)-9o6mg`` +- ``isStrictSubset(of:)-91par`` +- ``isStrictSubset(of:)-7n66e`` + +- ``isStrictSuperset(of:)-89ig3`` +- ``isStrictSuperset(of:)-1e0xt`` +- ``isStrictSuperset(of:)-5dsfd`` + +- ``isDisjoint(with:)-3wuso`` +- ``isDisjoint(with:)-25vmx`` +- ``isDisjoint(with:)-8nfqs`` diff --git a/Sources/Collections/Collections.docc/Extensions/OrderedSet.md b/Sources/Collections/Collections.docc/Extensions/OrderedSet.md new file mode 100644 index 00000000..a47d51f1 --- /dev/null +++ b/Sources/Collections/Collections.docc/Extensions/OrderedSet.md @@ -0,0 +1,136 @@ +# ``Collections/OrderedSet`` + + + + +## Topics + +### Creating a Set + +- ``init()`` +- ``init(_:)-5zktd`` +- ``init(_:)-3d7qr`` +- ``init(_:)-68j7`` +- ``init(_:)-8zm9d`` +- ``init(_:)-7rt2h`` +- ``init(_:)-8tli8`` +- ``init(_:)-2d3a9`` +- ``init(uncheckedUniqueElements:)`` +- ``init(minimumCapacity:persistent:)`` + +### Collection Views + +- ``UnorderedView`` +- ``unordered`` +- ``elements`` + +### Finding Elements + +- ``contains(_:)`` +- ``firstIndex(of:)`` +- ``lastIndex(of:)`` + +### Adding and Updating Elements + +- ``append(_:)`` +- ``insert(_:at:)`` +- ``append(contentsOf:)`` +- ``updateOrAppend(_:)`` +- ``updateOrInsert(_:at:)`` +- ``update(_:at:)`` + +### Removing Elements + +- ``filter(_:)`` +- ``removeAll(where:)`` +- ``remove(_:)`` +- ``remove(at:)`` +- ``removeAll(keepingCapacity:)`` +- ``removeFirst()`` +- ``removeLast()`` +- ``removeFirst(_:)`` +- ``removeLast(_:)`` +- ``removeSubrange(_:)-62u6a`` +- ``removeSubrange(_:)-2fqke`` + +### Combining Sets + +- ``intersection(_:)-4o09a`` +- ``intersection(_:)-9yzg3`` +- ``intersection(_:)-80md4`` + +- ``union(_:)-67y2h`` +- ``union(_:)-3lt5i`` +- ``union(_:)-2939h`` + +- ``subtracting(_:)-5graf`` +- ``subtracting(_:)-7kl8r`` +- ``subtracting(_:)-1gl4y`` + +- ``symmetricDifference(_:)-1810l`` +- ``symmetricDifference(_:)-8dvm6`` +- ``symmetricDifference(_:)-9huk7`` + +- ``formIntersection(_:)-43o1u`` +- ``formIntersection(_:)-2a4y4`` +- ``formIntersection(_:)-7odn2`` + +- ``formUnion(_:)-6pksr`` +- ``formUnion(_:)-3dkzw`` +- ``formUnion(_:)-59end`` + +- ``subtract(_:)-3b6nj`` +- ``subtract(_:)-9rtmd`` +- ``subtract(_:)-9wmg8`` + +- ``formSymmetricDifference(_:)-96csi`` +- ``formSymmetricDifference(_:)-2ll2z`` +- ``formSymmetricDifference(_:)-391sm`` + +### Comparing Sets + +- ``==(_:_:)`` + +- ``isSubset(of:)-ptij`` +- ``isSubset(of:)-3mw6r`` +- ``isSubset(of:)-8yb29`` +- ``isSubset(of:)-9hxl4`` + +- ``isSuperset(of:)-4rrsh`` +- ``isSuperset(of:)-2bbv8`` +- ``isSuperset(of:)-7xvog`` +- ``isSuperset(of:)-7oow7`` + +- ``isStrictSubset(of:)-8m21h`` +- ``isStrictSubset(of:)-9lv3x`` +- ``isStrictSubset(of:)-4efhn`` +- ``isStrictSubset(of:)-10abw`` + +- ``isStrictSuperset(of:)-7u97x`` +- ``isStrictSuperset(of:)-3kfwa`` +- ``isStrictSuperset(of:)-98d9s`` +- ``isStrictSuperset(of:)-5e6d5`` + +- ``isDisjoint(with:)-6vmoh`` +- ``isDisjoint(with:)-4tsmx`` +- ``isDisjoint(with:)-54iy6`` +- ``isDisjoint(with:)-7nqur`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)`` + +### Creating and Applying Differences + +- ``difference(from:)-30bkk`` +- ``applying(_:)`` + +### Memory Management + +- ``reserveCapacity(_:)`` diff --git a/Sources/DequeModule/DequeModule.docc/DequeModule.md b/Sources/DequeModule/DequeModule.docc/DequeModule.md new file mode 100644 index 00000000..0746973e --- /dev/null +++ b/Sources/DequeModule/DequeModule.docc/DequeModule.md @@ -0,0 +1,3 @@ +# ``DequeModule`` + +This module is dedicated to providing ``Deque``, a double-ended analogue of the standard `Array` type. diff --git a/Sources/DequeModule/DequeModule.docc/Extensions/Deque.md b/Sources/DequeModule/DequeModule.docc/Extensions/Deque.md new file mode 100644 index 00000000..4d3a8362 --- /dev/null +++ b/Sources/DequeModule/DequeModule.docc/Extensions/Deque.md @@ -0,0 +1,64 @@ +# ``DequeModule/Deque`` + +## Topics + +### Creating a Deque + +- ``init()`` +- ``init(_:)-8tyaw`` +- ``init(_:)-1tqf4`` +- ``init(minimumCapacity:)`` +- ``init(repeating:count:)-4v1gt`` +- ``init(unsafeUninitializedCapacity:initializingWith:)`` + +### Inspecting a Deque + +- ``count-8wcnm`` +- ``isEmpty`` + +### Manipulating Elements at the Front + +- ``first`` +- ``prepend(_:)`` +- ``prepend(contentsOf:)-96y15`` +- ``prepend(contentsOf:)-51zn6`` +- ``removeFirst()-1vdmt`` +- ``removeFirst(_:)-2vuji`` +- ``popFirst()`` +- ``prefix(_:)`` + +### Manipulating Elements at the End + +- ``last`` +- ``append(_:)-9h4m7`` +- ``append(contentsOf:)-8rqnl`` +- ``append(contentsOf:)-29aoh`` +- ``removeLast()`` +- ``removeLast(_:)`` +- ``popLast()`` +- ``suffix(_:)`` + +### Manipulating Elements Elsewhere + +- ``subscript(_:)-9nk44`` +- ``subscript(_:)-6ee8i`` +- ``subscript(_:)-1klky`` +- ``subscript(_:)-ejld`` +- ``insert(_:at:)-9hsp7`` +- ``insert(contentsOf:at:)-1d60f`` +- ``replaceSubrange(_:with:)-5rtzd`` +- ``remove(at:)-3imgi`` + +### Reordering Elements + +- ``swapAt(_:_:)-7910s`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)-90y0t`` + +### Memory Management + +- ``reserveCapacity(_:)`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Elements.md b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Elements.md new file mode 100644 index 00000000..752f3f5c --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Elements.md @@ -0,0 +1,37 @@ +# ``OrderedCollections/OrderedDictionary/Elements-swift.struct`` + +## Topics + +### Inspecting an Elements View + +- ``isEmpty`` +- ``count`` + +### Accessing Elements + +- ``subscript(_:)-4xwc2`` +- ``keys`` +- ``values`` +- ``index(forKey:)`` + +### Removing Elements + +- ``remove(at:)`` +- ``removeSubrange(_:)-5x7oo`` +- ``removeSubrange(_:)-7wdak`` +- ``removeAll(keepingCapacity:)`` +- ``removeAll(where:)`` +- ``removeFirst()`` +- ``removeFirst(_:)`` +- ``removeLast()`` +- ``removeLast(_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``reverse()`` +- ``sort()`` +- ``sort(by:)`` +- ``partition(by:)`` +- ``shuffle()`` +- ``shuffle(using:)`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Values.md b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Values.md new file mode 100644 index 00000000..6e50c1f4 --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.Values.md @@ -0,0 +1,24 @@ +# ``OrderedCollections/OrderedDictionary/Values-swift.struct`` + +## Topics + +### Inspecting a Values Collection + +- ``isEmpty`` +- ``count`` + +### Accessing Elements + +- ``subscript(_:)-25vfz`` +- ``elements`` +- ``withUnsafeBufferPointer(_:)`` +- ``withUnsafeMutableBufferPointer(_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)-77eiy`` +- ``partition(by:)-9x0i5`` +- ``sort()`` +- ``sort(by:)`` +- ``shuffle()`` +- ``shuffle(using:)`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.md b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.md new file mode 100644 index 00000000..7e0845ee --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedDictionary.md @@ -0,0 +1,94 @@ +# ``OrderedCollections/OrderedDictionary`` + +## Topics + +### Creating a Dictionary + +- ``init()`` +- ``init(minimumCapacity:persistent:)`` +- ``init(uniqueKeysWithValues:)-5ux9r`` +- ``init(uniqueKeysWithValues:)-88mzi`` +- ``init(uncheckedUniqueKeysWithValues:)-6gxhj`` +- ``init(uncheckedUniqueKeysWithValues:)-2j0dw`` +- ``init(uncheckedUniqueKeysWithValues:)-6gxhj`` +- ``init(uniqueKeys:values:)`` +- ``init(uncheckedUniqueKeys:values:)`` +- ``init(_:uniquingKeysWith:)-2y39b`` +- ``init(_:uniquingKeysWith:)-zhfp`` +- ``init(grouping:by:)-6mahw`` +- ``init(grouping:by:)-6m2zw`` + +### Inspecting a Dictionary + +- ``isEmpty`` +- ``count`` + +### Accessing Keys and Values + +- ``subscript(_:)`` +- ``subscript(_:default:)`` +- ``index(forKey:)`` + +### Collection Views + +- ``keys`` +- ``values-swift.property`` +- ``elements-swift.property`` + +### Updating Values + +- ``updateValue(_:forKey:)`` +- ``updateValue(_:forKey:insertingAt:)`` +- ``updateValue(forKey:default:with:)`` +- ``updateValue(forKey:insertingDefault:at:with:)`` + +### Removing Keys and Values + +- ``removeValue(forKey:)`` +- ``remove(at:)`` +- ``filter(_:)`` +- ``removeAll(where:)`` +- ``removeAll(keepingCapacity:)`` +- ``removeFirst()`` +- ``removeLast()`` +- ``removeFirst(_:)`` +- ``removeLast(_:)`` +- ``removeSubrange(_:)-512n3`` +- ``removeSubrange(_:)-8rmzx`` + +### Combining Dictionaries + +- ``merge(_:uniquingKeysWith:)-6ka2i`` +- ``merge(_:uniquingKeysWith:)-9wkad`` +- ``merging(_:uniquingKeysWith:)-4z49c`` +- ``merging(_:uniquingKeysWith:)-2e0xa`` + +### Comparing Dictionaries + +- ``==(_:_:)`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``reverse()`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)`` + +### Transforming a Dictionary + +- ``mapValues(_:)`` +- ``compactMapValues(_:)`` + +### Memory Management + +- ``reserveCapacity(_:)`` + +### Supporting Types + +- ``Index`` +- ``Values-swift.struct`` +- ``Elements-swift.struct`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md new file mode 100644 index 00000000..ebc2c889 --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md @@ -0,0 +1,53 @@ +# ``OrderedCollections/OrderedSet/UnorderedView`` + +## Topics + +### Binary Set Operations + +- ``intersection(_:)-3q45l`` +- ``intersection(_:)-6ee3o`` + +- ``union(_:)-79uk3`` +- ``union(_:)-23dm1`` + +- ``subtracting(_:)-3ct1b`` +- ``subtracting(_:)-8e6mw`` + +- ``symmetricDifference(_:)-6aed7`` +- ``symmetricDifference(_:)-7r79p`` + +- ``formIntersection(_:)-4ow38`` +- ``formIntersection(_:)-80iht`` + +- ``formUnion(_:)-6ijb`` +- ``formUnion(_:)-8tuol`` + +- ``subtract(_:)-627eq`` +- ``subtract(_:)-4pjhu`` + +- ``formSymmetricDifference(_:)-8pkt5`` +- ``formSymmetricDifference(_:)-75z52`` + +### Binary Set Predicates + +- ``==(_:_:)`` + +- ``isSubset(of:)-2dx31`` +- ``isSubset(of:)-801lo`` +- ``isSubset(of:)-952h5`` + +- ``isSuperset(of:)-9t33p`` +- ``isSuperset(of:)-2vtig`` +- ``isSuperset(of:)-9krpz`` + +- ``isStrictSubset(of:)-9o6mg`` +- ``isStrictSubset(of:)-91par`` +- ``isStrictSubset(of:)-7n66e`` + +- ``isStrictSuperset(of:)-89ig3`` +- ``isStrictSuperset(of:)-1e0xt`` +- ``isStrictSuperset(of:)-5dsfd`` + +- ``isDisjoint(with:)-3wuso`` +- ``isDisjoint(with:)-25vmx`` +- ``isDisjoint(with:)-8nfqs`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md new file mode 100644 index 00000000..eac28040 --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md @@ -0,0 +1,133 @@ +# ``OrderedCollections/OrderedSet`` + +## Topics + +### Creating a Set + +- ``init()`` +- ``init(_:)-5zktd`` +- ``init(_:)-3d7qr`` +- ``init(_:)-68j7`` +- ``init(_:)-8zm9d`` +- ``init(_:)-7rt2h`` +- ``init(_:)-8tli8`` +- ``init(_:)-2d3a9`` +- ``init(uncheckedUniqueElements:)`` +- ``init(minimumCapacity:persistent:)`` + +### Collection Views + +- ``UnorderedView`` +- ``unordered`` +- ``elements`` + +### Finding Elements + +- ``contains(_:)`` +- ``firstIndex(of:)`` +- ``lastIndex(of:)`` + +### Adding and Updating Elements + +- ``append(_:)`` +- ``insert(_:at:)`` +- ``append(contentsOf:)`` +- ``updateOrAppend(_:)`` +- ``updateOrInsert(_:at:)`` +- ``update(_:at:)`` + +### Removing Elements + +- ``filter(_:)`` +- ``removeAll(where:)`` +- ``remove(_:)`` +- ``remove(at:)`` +- ``removeAll(keepingCapacity:)`` +- ``removeFirst()`` +- ``removeLast()`` +- ``removeFirst(_:)`` +- ``removeLast(_:)`` +- ``removeSubrange(_:)-62u6a`` +- ``removeSubrange(_:)-2fqke`` + +### Combining Sets + +- ``intersection(_:)-4o09a`` +- ``intersection(_:)-9yzg3`` +- ``intersection(_:)-80md4`` + +- ``union(_:)-67y2h`` +- ``union(_:)-3lt5i`` +- ``union(_:)-2939h`` + +- ``subtracting(_:)-5graf`` +- ``subtracting(_:)-7kl8r`` +- ``subtracting(_:)-1gl4y`` + +- ``symmetricDifference(_:)-1810l`` +- ``symmetricDifference(_:)-8dvm6`` +- ``symmetricDifference(_:)-9huk7`` + +- ``formIntersection(_:)-43o1u`` +- ``formIntersection(_:)-2a4y4`` +- ``formIntersection(_:)-7odn2`` + +- ``formUnion(_:)-6pksr`` +- ``formUnion(_:)-3dkzw`` +- ``formUnion(_:)-59end`` + +- ``subtract(_:)-3b6nj`` +- ``subtract(_:)-9rtmd`` +- ``subtract(_:)-9wmg8`` + +- ``formSymmetricDifference(_:)-96csi`` +- ``formSymmetricDifference(_:)-2ll2z`` +- ``formSymmetricDifference(_:)-391sm`` + +### Comparing Sets + +- ``==(_:_:)`` + +- ``isSubset(of:)-ptij`` +- ``isSubset(of:)-3mw6r`` +- ``isSubset(of:)-8yb29`` +- ``isSubset(of:)-9hxl4`` + +- ``isSuperset(of:)-4rrsh`` +- ``isSuperset(of:)-2bbv8`` +- ``isSuperset(of:)-7xvog`` +- ``isSuperset(of:)-7oow7`` + +- ``isStrictSubset(of:)-8m21h`` +- ``isStrictSubset(of:)-9lv3x`` +- ``isStrictSubset(of:)-4efhn`` +- ``isStrictSubset(of:)-10abw`` + +- ``isStrictSuperset(of:)-7u97x`` +- ``isStrictSuperset(of:)-3kfwa`` +- ``isStrictSuperset(of:)-98d9s`` +- ``isStrictSuperset(of:)-5e6d5`` + +- ``isDisjoint(with:)-6vmoh`` +- ``isDisjoint(with:)-4tsmx`` +- ``isDisjoint(with:)-54iy6`` +- ``isDisjoint(with:)-7nqur`` + +### Reordering Elements + +- ``swapAt(_:_:)`` +- ``sort()`` +- ``sort(by:)`` +- ``reverse()`` +- ``shuffle()`` +- ``shuffle(using:)`` +- ``partition(by:)`` + +### Creating and Applying Differences + +- ``difference(from:)-30bkk`` +- ``applying(_:)`` + +### Memory Management + +- ``reserveCapacity(_:)`` diff --git a/Sources/OrderedCollections/OrderedCollections.docc/OrderedCollections.md b/Sources/OrderedCollections/OrderedCollections.docc/OrderedCollections.md new file mode 100644 index 00000000..dcc7288a --- /dev/null +++ b/Sources/OrderedCollections/OrderedCollections.docc/OrderedCollections.md @@ -0,0 +1,10 @@ +# ``OrderedCollections`` + +The `OrderedCollections` module provides hashed collection types that work like the standard `Set` and `Dictionary`, but maintain their elements in a particular user-specified order. + +## Topics + +### Structures + +- ``OrderedSet`` +- ``OrderedDictionary`` diff --git a/Utils/generate-docs.sh b/Utils/generate-docs.sh new file mode 100755 index 00000000..86506af1 --- /dev/null +++ b/Utils/generate-docs.sh @@ -0,0 +1,92 @@ +#!/bin/sh +#===---------------------------------------------------------------------- +# +# This source file is part of the Swift Collections open source project +# +# Copyright (c) 2022 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See https://swift.org/LICENSE.txt for license information +# +#===---------------------------------------------------------------------- + +set -eu + +shopt -s nullglob +cd "$(dirname $0)/.." + +if [ "$(uname)" = "Darwin" ]; then + swift="xcrun swift" + export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render" +else + swift="swift" +fi + +build_dir="$(mktemp -d "/tmp/$(basename $0).XXXXX")" +echo "Build directory: $build_dir" + +output_dir_base=/tmp/foo + +rm -rf "$output_dir_base" + +components="DequeModule OrderedCollections" + +if [ $# -eq 0 ]; then + targets="Collections $components" +else + targets="$@" +fi + +for target in $targets; do + if [ "$target" = "Collections" ]; then + # Update extensions under Collections.docc + rm -rf Sources/Collections/Collections.docc/Extensions/*.md + for component in $components; do + for file in Sources/"$component"/"$component".docc/Extensions/*.md; do + output="Sources/Collections/Collections.docc/Extensions/$(basename $file)" + blurb="" + sed 's?^# ``[^/]*/\(.*\)``?# ``Collections/\1``\n\n'"$blurb"'\n?' "$file" > "$output" + done + done + fi + + mkdir -p "$build_dir/$target/build" + mkdir -p "$build_dir/$target/symbol-graphs" + mkdir -p "$build_dir/$target/docc" + $swift build --target "$target" \ + --build-path "$build_dir/$target/build" \ + -Xswiftc -emit-symbol-graph \ + -Xswiftc -emit-symbol-graph-dir \ + -Xswiftc "$build_dir/$target/symbol-graphs" + + # Prevent DocC from getting confused by too much data :-/ + cp \ + "$build_dir/$target/symbol-graphs/$target.symbols.json" \ + "$build_dir/$target/docc" + extrafile="$build_dir/$target/symbol-graphs/${target}@Swift.symbols.json" + if [ -r "$extrafile" ]; then + cp "$extrafile" "$build_dir/$target/docc" + fi + + mkdir -p "$output_dir_base/$target" + xcrun docc convert \ + --analyze \ + --fallback-display-name "$target" \ + --fallback-bundle-identifier "org.swift.swift-collections.$target" \ + --fallback-bundle-version 1.1.0 \ + --default-code-listing-language swift \ + --additional-symbol-graph-dir "$build_dir/$target/docc" \ + --transform-for-static-hosting \ + --output-path "$output_dir_base/$target" \ + --hosting-base-path "/swift-collections/$target" \ + "Sources/$target/$target.docc" +done + +if [ $# -eq 1 ]; then + module="$1" + xcrun docc preview "Sources/$module/$module.docc" \ + --fallback-display-name "Swift Collections" \ + --fallback-bundle-identifier "org.swift.swift-collections.$module" \ + --fallback-bundle-version 1.1.0 \ + --additional-symbol-graph-dir "$build_dir/$module/docc" +fi