Commit Graph
46 Commits
Author SHA1 Message Date
Karoy Lorentey 35d5746117 Rename _CollectionsUtilities to InternalCollectionsUtilities
We are forced to do this due to an Xcode issue (#364) with underscored module names.

This module remains unstable, despite the removal of the underscore. Directly importing it from outside the package remains unsupported. This module and/or its entire contents may go away or change in incompatible ways in any future swift-collections release.
2024-05-29 14:00:13 -07:00
Karoy Lorentey 64b286d63d [OrderedCollections] Update copyright notices 2024-02-02 16:20:21 -08:00
Karoy Lorentey f59aeeb56a [OrderedCollections] Adopt modern generic declaration syntax and _specialize 2024-02-02 16:20:21 -08:00
Karoy Lorentey 1a0ac8c06c Merge branch 'release/1.0' into release/1.1
# Conflicts:
#	Sources/DequeModule/CMakeLists.txt
#	Sources/DequeModule/Deque+Collection.swift
#	Sources/DequeModule/Deque+Sendable.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Sendable.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Sequence.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+Sendable.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift
2023-12-21 15:17:15 -08:00
Karoy Lorentey 03d60bed63 Merge pull request #343 from lorentey/sendable-1.0
[1.0] Backport Sendable conformances on all public types
2023-12-18 18:43:30 -05:00
Karoy Lorentey 8bfcaddd5f [1.0] Update copyright dates 2023-12-18 15:35:56 -08:00
Karoy Lorentey 7d43c07a71 Backport Sendable conformances on all public types
Resolves #317
2023-12-18 15:25:38 -08:00
Karoy Lorentey 40e737cdaf [OrderedDictionary] Fix usage of deprecated API in index(forKey:) docs
Resolves #289.
2023-12-18 15:00:55 -08:00
Rick van Voorden e42fb868b7 forward ordered dictionary values equality to values property 2023-12-08 17:39:25 -08:00
Karoy Lorentey 09c09f0f73 Fix CustomStringConvertible/CustomDebugStringConvertible conformances
- For CustomStringConvertible, `description` should print elements using `String(reflecting:)` rather than `String(describing:)`, to avoid element output from interfering with syntactically relevant punctuation within structured list displays.
- To make this work without making displays overly verbose, make `debugDescription` mostly the same as `description`, except for escaping raw string displays when and if needed.
- Avoid printing type names in `debugDescription` — it is generally not helpful, as the type is already easily accessible elsewhere. Including it makes for overly verbose displays when the type serves as an Element of a collection.
- Avoid having `debugDescription` return the empty string — it can be confusing when such a description appears in list displays.

Resolves #301.
2023-07-06 17:25:11 -07:00
Karoy Lorentey 3e4a8b4dff Merge branch 'release/1.0' into release/1.1
# Conflicts:
#	.gitignore
#	Package.swift
#	Sources/Collections/Collections.docc/Collections.md
#	Sources/Collections/Collections.docc/Extensions/Deque.md
#	Sources/Collections/Collections.docc/Extensions/OrderedSet.UnorderedView.md
#	Sources/Collections/Collections.docc/Extensions/OrderedSet.md
#	Sources/DequeModule/DequeModule.docc/DequeModule.md
#	Sources/DequeModule/DequeModule.docc/Extensions/Deque.md
#	Sources/OrderedCollections/HashTable/_HashTable+UnsafeHandle.swift
#	Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md
#	Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md
#	Sources/OrderedCollections/OrderedCollections.docc/OrderedCollections.md
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet.swift
#	Sources/OrderedCollections/Utilities/_UnsafeBitset.swift
#	Utils/generate-docs.sh
2023-04-24 13:45:55 -07:00
Karoy Lorentey a8dad62bc9 Remove obsolete swift(>=5.5)/swift(>=5.6) checks 2023-04-10 18:33:52 -07:00
Ryan McLeod 7f63914a71 [OrderedDictionary] Explicitly mention in documentation that keys/values are ordered
(cherry picked from commit fef3839500)
2023-04-10 17:36:49 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey a874de5f7f [OrderedCollections] Refresh some docs with DocC links 2022-12-06 19:00:59 -08:00
Karoy Lorentey aaeeb9e440 [OrderedCollections] Doc updates 2022-10-28 12:34:14 -07:00
Karoy Lorentey de22bed429 [OrderedCollections] Update top-level docs 2022-10-28 12:34:14 -07:00
Karoy Lorentey 7143421800 [OrderedCollections] Add missing Custom[Debug]StringConvertable conformances, review existing ones
Add `Custom[Debug]StringConvertible` conformance on:

- `OrderedDictionary.Values`
- `OrderedDictionary.Elements.Subsequence`
- `OrderedSet.SubSequence`
2022-10-20 17:14:52 -07:00
Karoy Lorentey 381cf5d17e Merge branch 'release/1.0' into release/1.1 2022-10-19 15:50:34 -07:00
Karoy Lorentey f76630db8e [Internals] Add missing internal checking predicates & docs for all 2022-10-18 22:13:19 -07:00
Karoy Lorentey 51604cd196 [OrderedCollections] Oops, restore custom wording for areInIncreasingOrder variants 2022-10-12 15:11:57 -07:00
Karoy Lorentey a624614717 [OrderedCollections] Document that sort is stable (as of SE-0372) 2022-10-11 13:38:10 -07:00
Karoy Lorentey 17b6c8f5c7 [OrderedDictionary] OrderedDictionary, .Iterator, .Values, .Elements, .Elements.SubSequence, .Elements.SubSequence.Iterator: Explicitly conform to Sendable when Element is Sendable 2022-10-05 11:44:06 -07:00
Karoy Lorentey de31437ee5 Merge branch 'feature/PersistentCollections' into release/1.1 2022-09-19 16:02:51 -07:00
Karoy Lorentey 9f38e7424b [OrderedDictionary] Doc fix 2022-09-16 16:07:33 -07:00
Karoy Lorentey c9ca59fbb9 [PersistentCollections] Improved storage representation
- Switch to using `ManagedBuffer` to represent node storage. This has
  useful performance benefits, but it significantly complicates access
  to node data. We no longer have direct access to the underlying raw
  storage: everything needs to go through closures passed to
  `ManagedBuffer.withUnsafeMutablePointers`.

- Introduce `struct _Node` and `struct _Node.UnsafeHandle` to
  represent a (strong) reference to a hash tree node, and a
  convenient handle for node storage, respectively. Use these instead
  of directly accessing the ManagedBuffer object, whenever feasible.

- Implement separate paths for in-place mutations vs copy-on-write
  operation, optimizing both flavors.

- Go to great lengths to eliminate unnecessary retain-release traffic,
  whenever possible.

- Push subtree counts into parent nodes by moving the corresponding
  field from the node header into the `_Node` struct. (This results in
  a cool ~20x speedup for jumping around in the tree by integer
  offsets.)

- Implement a type-punned empty root singleton, to allow creating
  empty trees without allocating anything.
2022-09-13 23:48:54 -07:00
Karoy Lorentey 77edbef16d [_CollectionsUtilities] Restore original debug descriptions 2022-09-13 23:45:22 -07:00
Karoy Lorentey dd76591970 [_CollectionsUtilities] New module. Use it to unify description/debugDescription implementations 2022-09-12 12:47:04 -07:00
Karoy Lorentey a9e2276472 Merge pull request #168 from lorentey/cherry-pick-1.0.3
Cherry pick recent fixes to release/1.0 in preparation of tagging 1.0.3
2022-09-01 17:21:25 -07:00
Karoy Lorentey 71aa4a39ae [OrderedDictionary] Resolve spurious(?) call-site ambiguities 2022-08-31 17:57:24 -07:00
Karoy Lorentey b379fa7aee [OrderedCollections] Force-inline all _modify accessors
(cherry picked from commit ee1b2de06e)
2022-08-31 17:13:53 -07:00
Karoy Lorentey 6cb037037d [OrderedDictionary][doc] Update docs for merge/filter operations
Resolves #145
2022-05-23 16:17:35 -07:00
Karoy Lorentey 50e6a1ac71 [OrderedDictionary] Fix type inference issue with OrderedDictionary.init(grouping:by:)
This adds a new overload to help the type checker infer `[S.Element]` as the default `Value` type.

Resolves #139.
2022-02-08 14:16:18 -08:00
Karoy Lorentey e959a64528 [OrderedDictionary] Add some more _checkInvariants() calls 2021-09-08 21:12:52 -07:00
Karoy Lorentey 9d4bb8cdf8 [OrderedDictionary] Remove deprecated API
Mark the deprecated `subscript(offset:)` and `modifyValue(...)` APIs unavailable and replace their bodies with fatalError().
2021-09-03 19:11:29 -07:00
ejmarchant 4c22d00065 Follow stdlib's leading underscore rule (#95) 2021-08-30 15:44:27 -07:00
Edward Marchant 751ae1b08b Documentation: Remove in-place mutation comments 2021-08-30 15:44:27 -07:00
Karoy Lorentey 9d8719c8be [OrderedDictionary] Deprecate subscript(offset:) for now (#92)
* [OrderedDictionary] Deprecate index(forKey:), subscript(offset:) and friends for now

* [OrderedDictionary] Update tests

* Update benchmarks

* Un-deprecate index(forKey:)
2021-08-19 19:26:41 -07:00
Karoy Lorentey 1e68069c98 [OrderedDictionary] modifyValue → updateValue (#91)
* [OrderedDictionary] modifyValue → updateValue

* Update CMakeLists.txt
2021-08-19 19:26:41 -07:00
ejmarchant 5ff8c003b0 Fix documentation for types conforming to ExpressibleByArrayLiteral or ExpressibleByDictionaryLiteral (#82)
# Conflicts:
#	Sources/PriorityQueueModule/Heap+ExpressibleByArrayLiteral.swift
2021-08-19 19:26:41 -07:00
ejmarchant 85a207063b Fix typos: missing subscript parameters (#81)
* Fix typos: missing subscript parameters

* Fix typos: more missing subscript parameters

* Improve symbol documentation
2021-08-19 19:26:41 -07:00
Vihan 2aeaac76ae Update invalid OrderedDictionary invariant check. (#53) 2021-06-10 10:54:34 -07:00
François Lamboley f6d8f82627 Replace Index with Int where possible (#32) 2021-05-10 16:36:10 -07:00
Karoy Lorentey 65a38419d0 [OrderedDictionary] Document encoding format (#26)
Unlike the regular unordered `Dictionary`, `OrderedDictionary` always encodes/decodes itself as alternating key/value pairs in an unkeyed container. Document this fact (and the reason behind it) in the `Decodable` implementation.
2021-04-16 15:59:00 -07:00
Franklin Byaruhanga b68a025e23 Minor Fix in documentation for function OrderedDictionary.updateValue
Signed-off-by: Franklin Byaruhanga <byaruhaf@appbantu.com>
2021-04-06 16:46:04 -07:00
Karoy Lorentey a2bcac435f Initial import.
Introduce OrderedCollections module
2021-04-05 09:41:00 -07:00