From c883a1729ac36de8cfc30729dd9650a98ce5c5a3 Mon Sep 17 00:00:00 2001 From: Tony Parker Date: Thu, 17 Jul 2025 15:02:45 -0700 Subject: [PATCH] Add support for embedded Swift mode Remove calls to `debugPrint` (which does not exist), and ifdef out support for `Codable` and `Reflection`. --- Sources/BitCollections/BitArray/BitArray+Codable.swift | 2 ++ .../BitArray/BitArray+CustomReflectable.swift | 2 ++ Sources/BitCollections/BitArray/BitArray+Descriptions.swift | 2 ++ .../BitArray/BitArray+ExpressibleByStringLiteral.swift | 2 ++ .../BitArray/BitArray+LosslessStringConvertible.swift | 2 ++ Sources/BitCollections/BitSet/BitSet+Codable.swift | 2 ++ .../BitSet/BitSet+CustomDebugStringConvertible.swift | 2 ++ .../BitCollections/BitSet/BitSet+CustomReflectable.swift | 2 ++ .../BitSet/BitSet+CustomStringConvertible.swift | 2 ++ Sources/BitCollections/BitSet/BitSet.Counted.swift | 6 ++++++ Sources/BitCollections/BitSet/BitSet.Index.swift | 2 ++ Sources/BitCollections/Shared/_Word.swift | 2 ++ Sources/DequeModule/Deque+Codable.swift | 2 ++ Sources/DequeModule/Deque+CustomReflectable.swift | 2 ++ Sources/DequeModule/Deque+Descriptions.swift | 2 ++ .../TreeDictionary/TreeDictionary+Codable.swift | 2 ++ .../TreeDictionary/TreeDictionary+Collection.swift | 2 ++ .../TreeDictionary/TreeDictionary+CustomReflectable.swift | 2 ++ .../TreeDictionary/TreeDictionary+Descriptions.swift | 2 ++ .../TreeDictionary/TreeDictionary+Keys.swift | 2 ++ .../TreeDictionary/TreeDictionary+Values.swift | 2 ++ Sources/HashTreeCollections/TreeSet/TreeSet+Codable.swift | 2 ++ .../HashTreeCollections/TreeSet/TreeSet+Collection.swift | 2 ++ .../TreeSet/TreeSet+CustomReflectable.swift | 2 ++ .../HashTreeCollections/TreeSet/TreeSet+Descriptions.swift | 2 ++ Sources/HeapModule/Heap+Descriptions.swift | 3 ++- Sources/InternalCollectionsUtilities/Descriptions.swift.gyb | 2 ++ .../autogenerated/Descriptions.swift | 4 ++++ .../OrderedDictionary/OrderedDictionary+Codable.swift | 2 ++ .../OrderedDictionary+CustomReflectable.swift | 2 ++ .../OrderedDictionary/OrderedDictionary+Descriptions.swift | 2 ++ .../OrderedDictionary+Elements.SubSequence.swift | 2 ++ .../OrderedDictionary/OrderedDictionary+Elements.swift | 4 ++++ .../OrderedDictionary/OrderedDictionary+Values.swift | 2 ++ .../OrderedCollections/OrderedSet/OrderedSet+Codable.swift | 2 ++ .../OrderedSet/OrderedSet+CustomReflectable.swift | 2 ++ .../OrderedSet/OrderedSet+Descriptions.swift | 2 ++ .../OrderedSet/OrderedSet+SubSequence.swift | 2 ++ .../OrderedSet/OrderedSet+UnorderedView.swift | 4 ++++ .../SortedCollections/BTree/_BTree+CustomReflectable.swift | 2 ++ Sources/SortedCollections/BTree/_FixedSizeArray.swift | 2 ++ .../_Node.UnsafeHandle+CustomDebugStringConvertible.swift | 2 ++ .../SortedDictionary/SortedDictionary+Codable.swift | 2 ++ .../SortedDictionary+CustomReflectable.swift | 2 ++ .../SortedDictionary+CustomStringConvertible.swift | 2 ++ Sources/SortedCollections/SortedSet/SortedSet+Codable.swift | 2 ++ .../SortedSet/SortedSet+CustomReflectable.swift | 2 ++ .../SortedSet/SortedSet+CustomStringConvertible.swift | 2 ++ 48 files changed, 106 insertions(+), 1 deletion(-) diff --git a/Sources/BitCollections/BitArray/BitArray+Codable.swift b/Sources/BitCollections/BitArray/BitArray+Codable.swift index bc4b9626..f1d29bbc 100644 --- a/Sources/BitCollections/BitArray/BitArray+Codable.swift +++ b/Sources/BitCollections/BitArray/BitArray+Codable.swift @@ -11,6 +11,7 @@ import InternalCollectionsUtilities +#if !$Embedded extension BitArray: Codable { /// Encodes this bit array into the given encoder. /// @@ -73,3 +74,4 @@ extension BitArray: Codable { self.init(_storage: words, count: count) } } +#endif diff --git a/Sources/BitCollections/BitArray/BitArray+CustomReflectable.swift b/Sources/BitCollections/BitArray/BitArray+CustomReflectable.swift index e3bdae41..35dceb3b 100644 --- a/Sources/BitCollections/BitArray/BitArray+CustomReflectable.swift +++ b/Sources/BitCollections/BitArray/BitArray+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitArray: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .collection) } } +#endif diff --git a/Sources/BitCollections/BitArray/BitArray+Descriptions.swift b/Sources/BitCollections/BitArray/BitArray+Descriptions.swift index 97e44433..0814d848 100644 --- a/Sources/BitCollections/BitArray/BitArray+Descriptions.swift +++ b/Sources/BitCollections/BitArray/BitArray+Descriptions.swift @@ -23,6 +23,7 @@ extension UInt8 { internal static var _asciiGT: Self { 62 } } +#if !$Embedded extension BitArray: CustomStringConvertible { /// A textual representation of this instance. /// Bit arrays print themselves as a string of binary bits, with the @@ -55,6 +56,7 @@ extension BitArray: CustomDebugStringConvertible { description } } +#endif extension BitArray { internal var _bitString: String { diff --git a/Sources/BitCollections/BitArray/BitArray+ExpressibleByStringLiteral.swift b/Sources/BitCollections/BitArray/BitArray+ExpressibleByStringLiteral.swift index db7b9637..cf4255ec 100644 --- a/Sources/BitCollections/BitArray/BitArray+ExpressibleByStringLiteral.swift +++ b/Sources/BitCollections/BitArray/BitArray+ExpressibleByStringLiteral.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitArray: ExpressibleByStringLiteral { /// Creates an instance initialized with the given elements. @inlinable @@ -19,3 +20,4 @@ extension BitArray: ExpressibleByStringLiteral { self = bits } } +#endif diff --git a/Sources/BitCollections/BitArray/BitArray+LosslessStringConvertible.swift b/Sources/BitCollections/BitArray/BitArray+LosslessStringConvertible.swift index f87e7050..82d56ae8 100644 --- a/Sources/BitCollections/BitArray/BitArray+LosslessStringConvertible.swift +++ b/Sources/BitCollections/BitArray/BitArray+LosslessStringConvertible.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitArray: LosslessStringConvertible { /// Initializes a new bit array from a string representation. /// @@ -62,3 +63,4 @@ extension BitArray: LosslessStringConvertible { guard success else { return nil } } } +#endif diff --git a/Sources/BitCollections/BitSet/BitSet+Codable.swift b/Sources/BitCollections/BitSet/BitSet+Codable.swift index 8563193a..2f6612ad 100644 --- a/Sources/BitCollections/BitSet/BitSet+Codable.swift +++ b/Sources/BitCollections/BitSet/BitSet+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitSet: Codable { /// Encodes this bit set into the given encoder. /// @@ -34,3 +35,4 @@ extension BitSet: Codable { self.init(_words: words) } } +#endif diff --git a/Sources/BitCollections/BitSet/BitSet+CustomDebugStringConvertible.swift b/Sources/BitCollections/BitSet/BitSet+CustomDebugStringConvertible.swift index 0a0ad741..a9b8e8f2 100644 --- a/Sources/BitCollections/BitSet/BitSet+CustomDebugStringConvertible.swift +++ b/Sources/BitCollections/BitSet/BitSet+CustomDebugStringConvertible.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitSet: CustomDebugStringConvertible { /// A textual representation of this instance, suitable for debugging. public var debugDescription: String { description } } +#endif diff --git a/Sources/BitCollections/BitSet/BitSet+CustomReflectable.swift b/Sources/BitCollections/BitSet/BitSet+CustomReflectable.swift index 6827e9e6..9f7aa248 100644 --- a/Sources/BitCollections/BitSet/BitSet+CustomReflectable.swift +++ b/Sources/BitCollections/BitSet/BitSet+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension BitSet: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .set) } } +#endif diff --git a/Sources/BitCollections/BitSet/BitSet+CustomStringConvertible.swift b/Sources/BitCollections/BitSet/BitSet+CustomStringConvertible.swift index 266516a7..662f8707 100644 --- a/Sources/BitCollections/BitSet/BitSet+CustomStringConvertible.swift +++ b/Sources/BitCollections/BitSet/BitSet+CustomStringConvertible.swift @@ -13,9 +13,11 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension BitSet: CustomStringConvertible { // A textual representation of this instance. public var description: String { _arrayDescription(for: self) } } +#endif diff --git a/Sources/BitCollections/BitSet/BitSet.Counted.swift b/Sources/BitCollections/BitSet/BitSet.Counted.swift index f8c805a1..51812b23 100644 --- a/Sources/BitCollections/BitSet/BitSet.Counted.swift +++ b/Sources/BitCollections/BitSet/BitSet.Counted.swift @@ -175,6 +175,7 @@ extension BitSet.Counted: BidirectionalCollection { } +#if !$Embedded extension BitSet.Counted: Codable { public func encode(to encoder: Encoder) throws { try _bits.encode(to: encoder) @@ -184,7 +185,9 @@ extension BitSet.Counted: Codable { self.init(try BitSet(from: decoder)) } } +#endif +#if !$Embedded extension BitSet.Counted: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -198,12 +201,15 @@ extension BitSet.Counted: CustomDebugStringConvertible { description } } +#endif +#if !$Embedded extension BitSet.Counted: CustomReflectable { public var customMirror: Mirror { _bits.customMirror } } +#endif extension BitSet.Counted: Equatable { public static func ==(left: Self, right: Self) -> Bool { diff --git a/Sources/BitCollections/BitSet/BitSet.Index.swift b/Sources/BitCollections/BitSet/BitSet.Index.swift index 3cc67231..2f73f80a 100644 --- a/Sources/BitCollections/BitSet/BitSet.Index.swift +++ b/Sources/BitCollections/BitSet/BitSet.Index.swift @@ -45,6 +45,7 @@ extension BitSet { extension BitSet.Index: Sendable {} +#if !$Embedded extension BitSet.Index: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -58,6 +59,7 @@ extension BitSet.Index: CustomDebugStringConvertible { description } } +#endif extension BitSet.Index: Equatable { /// Returns a Boolean value indicating whether two values are equal. diff --git a/Sources/BitCollections/Shared/_Word.swift b/Sources/BitCollections/Shared/_Word.swift index 0917a491..14ac320b 100644 --- a/Sources/BitCollections/Shared/_Word.swift +++ b/Sources/BitCollections/Shared/_Word.swift @@ -16,6 +16,7 @@ import InternalCollectionsUtilities @usableFromInline internal typealias _Word = _UnsafeBitSet._Word +#if !$Embedded extension Array where Element == _Word { internal func _encodeAsUInt64( to container: inout UnkeyedEncodingContainer @@ -70,3 +71,4 @@ extension Array where Element == _Word { } } } +#endif diff --git a/Sources/DequeModule/Deque+Codable.swift b/Sources/DequeModule/Deque+Codable.swift index abef341e..f90340ee 100644 --- a/Sources/DequeModule/Deque+Codable.swift +++ b/Sources/DequeModule/Deque+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension Deque: Encodable where Element: Encodable { /// Encodes the elements of this deque into the given encoder in an unkeyed /// container. @@ -47,3 +48,4 @@ extension Deque: Decodable where Element: Decodable { } } } +#endif diff --git a/Sources/DequeModule/Deque+CustomReflectable.swift b/Sources/DequeModule/Deque+CustomReflectable.swift index 472c2899..4b4e875a 100644 --- a/Sources/DequeModule/Deque+CustomReflectable.swift +++ b/Sources/DequeModule/Deque+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension Deque: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .collection) } } +#endif diff --git a/Sources/DequeModule/Deque+Descriptions.swift b/Sources/DequeModule/Deque+Descriptions.swift index 921a5831..43a22e61 100644 --- a/Sources/DequeModule/Deque+Descriptions.swift +++ b/Sources/DequeModule/Deque+Descriptions.swift @@ -13,6 +13,7 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension Deque: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -26,3 +27,4 @@ extension Deque: CustomDebugStringConvertible { description } } +#endif diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Codable.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Codable.swift index d0dbc2f9..72976f4b 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Codable.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded // Code in this file is a slightly adapted variant of `Dictionary`'s `Codable` // implementation in the Standard Library as of Swift 5.7. // `TreeDictionary` therefore encodes/decodes itself exactly the same as @@ -184,3 +185,4 @@ where Key: Decodable, Value: Decodable } } +#endif diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift index ad73356a..a3012eb3 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift @@ -84,6 +84,7 @@ extension TreeDictionary.Index: Hashable { } } +#if !$Embedded extension TreeDictionary.Index: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -97,6 +98,7 @@ extension TreeDictionary.Index: CustomDebugStringConvertible { description } } +#endif extension TreeDictionary: Collection { /// A Boolean value indicating whether the collection is empty. diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+CustomReflectable.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+CustomReflectable.swift index 046b7855..26b1a591 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+CustomReflectable.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension TreeDictionary: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .dictionary) } } +#endif diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Descriptions.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Descriptions.swift index 0f510192..ca477c80 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Descriptions.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Descriptions.swift @@ -13,6 +13,7 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension TreeDictionary: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -26,3 +27,4 @@ extension TreeDictionary: CustomDebugStringConvertible { description } } +#endif diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift index 6899581e..f05eb1fe 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift @@ -43,6 +43,7 @@ where Key: Sendable, Value: Sendable {} extension TreeDictionary.Keys: _UniqueCollection {} +#if !$Embedded extension TreeDictionary.Keys: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -56,6 +57,7 @@ extension TreeDictionary.Keys: CustomDebugStringConvertible { description } } +#endif extension TreeDictionary.Keys: Sequence { /// The element type of the collection. diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift index aa646cfb..429ee735 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift @@ -46,6 +46,7 @@ extension TreeDictionary { extension TreeDictionary.Values: Sendable where Key: Sendable, Value: Sendable {} +#if !$Embedded extension TreeDictionary.Values: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -59,6 +60,7 @@ extension TreeDictionary.Values: CustomDebugStringConvertible { description } } +#endif extension TreeDictionary.Values: Sequence { public typealias Element = Value diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Codable.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Codable.swift index 1d808026..655d9ce4 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Codable.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension TreeSet: Encodable where Element: Encodable { /// Encodes the elements of this set into the given encoder. /// @@ -44,3 +45,4 @@ extension TreeSet: Decodable where Element: Decodable { } } } +#endif diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift index c2fcd3e1..b0a8f72d 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift @@ -85,6 +85,7 @@ extension TreeSet.Index: Hashable { } } +#if !$Embedded extension TreeSet.Index: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -98,6 +99,7 @@ extension TreeSet.Index: CustomDebugStringConvertible { description } } +#endif extension TreeSet: Collection { /// A Boolean value indicating whether the collection is empty. diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+CustomReflectable.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+CustomReflectable.swift index e10bee5a..a7b28c16 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+CustomReflectable.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension TreeSet: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .set) } } +#endif diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Descriptions.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Descriptions.swift index b8219570..ee54fb26 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Descriptions.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Descriptions.swift @@ -13,6 +13,7 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension TreeSet: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -26,3 +27,4 @@ extension TreeSet: CustomDebugStringConvertible { description } } +#endif diff --git a/Sources/HeapModule/Heap+Descriptions.swift b/Sources/HeapModule/Heap+Descriptions.swift index 7a26ea02..19466aea 100644 --- a/Sources/HeapModule/Heap+Descriptions.swift +++ b/Sources/HeapModule/Heap+Descriptions.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension Heap: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -32,4 +33,4 @@ extension Heap: CustomDebugStringConvertible { description } } - +#endif diff --git a/Sources/InternalCollectionsUtilities/Descriptions.swift.gyb b/Sources/InternalCollectionsUtilities/Descriptions.swift.gyb index fa44ef68..eea428dd 100644 --- a/Sources/InternalCollectionsUtilities/Descriptions.swift.gyb +++ b/Sources/InternalCollectionsUtilities/Descriptions.swift.gyb @@ -33,6 +33,7 @@ ${modifier} func _addressString(for object: Unmanaged) -> Strin _addressString(for: object.toOpaque()) } +#if !$Embedded @inlinable ${modifier} func _arrayDescription( for elements: C @@ -71,5 +72,6 @@ ${modifier} func _dictionaryDescription( result += "]" return result } +#endif % end ${visibility_boilerplate("end")} diff --git a/Sources/InternalCollectionsUtilities/autogenerated/Descriptions.swift b/Sources/InternalCollectionsUtilities/autogenerated/Descriptions.swift index 2c84f8ea..6dc2ab7c 100644 --- a/Sources/InternalCollectionsUtilities/autogenerated/Descriptions.swift +++ b/Sources/InternalCollectionsUtilities/autogenerated/Descriptions.swift @@ -39,6 +39,7 @@ internal func _addressString(for object: Unmanaged) -> String { _addressString(for: object.toOpaque()) } +#if !$Embedded @inlinable internal func _arrayDescription( for elements: C @@ -77,6 +78,7 @@ internal func _dictionaryDescription( result += "]" return result } +#endif #else // !COLLECTIONS_SINGLE_MODULE //@usableFromInline @@ -95,6 +97,7 @@ public func _addressString(for object: Unmanaged) -> String { _addressString(for: object.toOpaque()) } +#if !$Embedded @inlinable public func _arrayDescription( for elements: C @@ -133,4 +136,5 @@ public func _dictionaryDescription( result += "]" return result } +#endif #endif // COLLECTIONS_SINGLE_MODULE diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Codable.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Codable.swift index af8c7eda..579a02ac 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Codable.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension OrderedDictionary: Encodable where Key: Encodable, Value: Encodable { /// Encodes the contents of this dictionary into the given encoder. /// @@ -85,3 +86,4 @@ extension OrderedDictionary: Decodable where Key: Decodable, Value: Decodable { _checkInvariants() } } +#endif diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+CustomReflectable.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+CustomReflectable.swift index 04296d76..68e42401 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+CustomReflectable.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension OrderedDictionary: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self.elements, displayStyle: .dictionary) } } +#endif diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Descriptions.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Descriptions.swift index 390a950b..541d5c3c 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Descriptions.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Descriptions.swift @@ -13,6 +13,7 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension OrderedDictionary: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -26,3 +27,4 @@ extension OrderedDictionary: CustomDebugStringConvertible { description } } +#endif diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift index 1a8319d6..97525420 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift @@ -37,6 +37,7 @@ extension OrderedDictionary.Elements { extension OrderedDictionary.Elements.SubSequence: Sendable where Key: Sendable, Value: Sendable {} +#if !$Embedded extension OrderedDictionary.Elements.SubSequence: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -50,6 +51,7 @@ extension OrderedDictionary.Elements.SubSequence: CustomDebugStringConvertible { description } } +#endif extension OrderedDictionary.Elements.SubSequence { /// A read-only collection view containing the keys in this slice. diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift index a9ded44b..d62762df 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift @@ -333,6 +333,7 @@ extension OrderedDictionary.Elements: RandomAccessCollection { } } +#if !$Embedded extension OrderedDictionary.Elements: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -346,12 +347,15 @@ extension OrderedDictionary.Elements: CustomDebugStringConvertible { description } } +#endif +#if !$Embedded extension OrderedDictionary.Elements: CustomReflectable { public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .collection) } } +#endif extension OrderedDictionary.Elements: Equatable where Value: Equatable { @inlinable diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift index ee2a4ac2..7aeabeb2 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift @@ -31,6 +31,7 @@ extension OrderedDictionary { extension OrderedDictionary.Values: Sendable where Key: Sendable, Value: Sendable {} +#if !$Embedded extension OrderedDictionary.Values: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -44,6 +45,7 @@ extension OrderedDictionary.Values: CustomDebugStringConvertible { description } } +#endif extension OrderedDictionary.Values { /// A read-only view of the contents of this collection as an array value. diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+Codable.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+Codable.swift index e0999c08..9d1a56aa 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+Codable.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension OrderedSet: Encodable where Element: Encodable { /// Encodes the elements of this ordered set into the given encoder. /// @@ -44,3 +45,4 @@ extension OrderedSet: Decodable where Element: Decodable { elements.count > _HashTable.maximumUnhashedCount ? table : nil) } } +#endif diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+CustomReflectable.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+CustomReflectable.swift index 8eb8415b..61443266 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+CustomReflectable.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension OrderedSet: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: _elements, displayStyle: .set) } } +#endif diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+Descriptions.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+Descriptions.swift index 5db6aa98..6d097d83 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+Descriptions.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+Descriptions.swift @@ -13,6 +13,7 @@ import InternalCollectionsUtilities #endif +#if !$Embedded extension OrderedSet: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -26,3 +27,4 @@ extension OrderedSet: CustomDebugStringConvertible { description } } +#endif diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift index 38105e99..e80a699f 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift @@ -53,6 +53,7 @@ extension OrderedSet.SubSequence { } } +#if !$Embedded extension OrderedSet.SubSequence: CustomStringConvertible { // A textual representation of this instance. public var description: String { @@ -66,6 +67,7 @@ extension OrderedSet.SubSequence: CustomDebugStringConvertible { description } } +#endif extension OrderedSet.SubSequence: Sequence { // A type representing the collection’s elements. diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift index 12bb94e8..48c0b699 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift @@ -68,6 +68,7 @@ extension OrderedSet { extension OrderedSet.UnorderedView: Sendable where Element: Sendable {} +#if !$Embedded extension OrderedSet.UnorderedView: CustomStringConvertible { /// A textual representation of this instance. public var description: String { @@ -81,13 +82,16 @@ extension OrderedSet.UnorderedView: CustomDebugStringConvertible { description } } +#endif +#if !$Embedded extension OrderedSet.UnorderedView: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: _base._elements, displayStyle: .collection) } } +#endif extension OrderedSet.UnorderedView: Equatable { /// Returns a Boolean value indicating whether two values are equal. diff --git a/Sources/SortedCollections/BTree/_BTree+CustomReflectable.swift b/Sources/SortedCollections/BTree/_BTree+CustomReflectable.swift index 30721d57..c90eb23b 100644 --- a/Sources/SortedCollections/BTree/_BTree+CustomReflectable.swift +++ b/Sources/SortedCollections/BTree/_BTree+CustomReflectable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension _BTree: CustomReflectable { /// The custom mirror for this instance. @inlinable @@ -16,3 +17,4 @@ extension _BTree: CustomReflectable { Mirror(self, unlabeledChildren: self, displayStyle: .dictionary) } } +#endif diff --git a/Sources/SortedCollections/BTree/_FixedSizeArray.swift b/Sources/SortedCollections/BTree/_FixedSizeArray.swift index 51a6c652..0352f762 100644 --- a/Sources/SortedCollections/BTree/_FixedSizeArray.swift +++ b/Sources/SortedCollections/BTree/_FixedSizeArray.swift @@ -113,6 +113,7 @@ internal struct _FixedSizeArray { } } +#if !$Embedded #if DEBUG extension _FixedSizeArray: CustomDebugStringConvertible { @inlinable @@ -131,3 +132,4 @@ extension _FixedSizeArray: CustomDebugStringConvertible { } } #endif +#endif diff --git a/Sources/SortedCollections/BTree/_Node.UnsafeHandle+CustomDebugStringConvertible.swift b/Sources/SortedCollections/BTree/_Node.UnsafeHandle+CustomDebugStringConvertible.swift index d61cd01f..3c37f202 100644 --- a/Sources/SortedCollections/BTree/_Node.UnsafeHandle+CustomDebugStringConvertible.swift +++ b/Sources/SortedCollections/BTree/_Node.UnsafeHandle+CustomDebugStringConvertible.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded // MARK: CustomDebugStringConvertible extension _Node.UnsafeHandle: CustomDebugStringConvertible { #if DEBUG @@ -147,3 +148,4 @@ extension _Node.UnsafeHandle: CustomDebugStringConvertible { } #endif // DEBUG } +#endif diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Codable.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Codable.swift index 496be575..11df1b44 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Codable.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedDictionary: Encodable where Key: Codable, Value: Codable { /// Encodes the contents of this dictionary into the given encoder. /// @@ -73,3 +74,4 @@ extension SortedDictionary: Decodable where Key: Decodable, Value: Decodable { self.init(_rootedAt: builder.finish()) } } +#endif diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomReflectable.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomReflectable.swift index 7f34e156..ef62ac18 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomReflectable.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedDictionary: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .dictionary) } } +#endif diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomStringConvertible.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomStringConvertible.swift index 49b63d2e..c0d3d9a9 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomStringConvertible.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+CustomStringConvertible.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedDictionary: CustomStringConvertible, CustomDebugStringConvertible { @inlinable public var description: String { @@ -50,3 +51,4 @@ extension SortedDictionary: CustomStringConvertible, CustomDebugStringConvertibl return result } } +#endif diff --git a/Sources/SortedCollections/SortedSet/SortedSet+Codable.swift b/Sources/SortedCollections/SortedSet/SortedSet+Codable.swift index 6534e7f2..c2e6998d 100644 --- a/Sources/SortedCollections/SortedSet/SortedSet+Codable.swift +++ b/Sources/SortedCollections/SortedSet/SortedSet+Codable.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedSet: Encodable where Element: Encodable { /// Encodes the elements of this ordered set into the given encoder. /// @@ -50,3 +51,4 @@ extension SortedSet: Decodable where Element: Decodable { self.init(_rootedAt: builder.finish()) } } +#endif diff --git a/Sources/SortedCollections/SortedSet/SortedSet+CustomReflectable.swift b/Sources/SortedCollections/SortedSet/SortedSet+CustomReflectable.swift index 4177fc61..b97d6930 100644 --- a/Sources/SortedCollections/SortedSet/SortedSet+CustomReflectable.swift +++ b/Sources/SortedCollections/SortedSet/SortedSet+CustomReflectable.swift @@ -9,9 +9,11 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedSet: CustomReflectable { /// The custom mirror for this instance. public var customMirror: Mirror { Mirror(self, unlabeledChildren: self, displayStyle: .set) } } +#endif diff --git a/Sources/SortedCollections/SortedSet/SortedSet+CustomStringConvertible.swift b/Sources/SortedCollections/SortedSet/SortedSet+CustomStringConvertible.swift index eeade805..ff518fdb 100644 --- a/Sources/SortedCollections/SortedSet/SortedSet+CustomStringConvertible.swift +++ b/Sources/SortedCollections/SortedSet/SortedSet+CustomStringConvertible.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +#if !$Embedded extension SortedSet: CustomStringConvertible, CustomDebugStringConvertible { @inlinable public var description: String { @@ -43,3 +44,4 @@ extension SortedSet: CustomStringConvertible, CustomDebugStringConvertible { return result } } +#endif