From 339f1677450d7a8f43518d61cfd93be85fa080c3 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 7 Nov 2022 18:53:07 -0800 Subject: [PATCH] [ShareableHashedCollections] API Review: add missing `mutating` keywords --- .../ShareableHashedCollections.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Documentation/Reviews/2022-10-31.ShareableHashedCollections/ShareableHashedCollections.md b/Documentation/Reviews/2022-10-31.ShareableHashedCollections/ShareableHashedCollections.md index c7ef11fc..11feb618 100644 --- a/Documentation/Reviews/2022-10-31.ShareableHashedCollections/ShareableHashedCollections.md +++ b/Documentation/Reviews/2022-10-31.ShareableHashedCollections/ShareableHashedCollections.md @@ -136,16 +136,16 @@ func lastIndex(of: Element) -> Index? #### Adding and Updating Elements ```swift -func insert(Element) -> (inserted: Bool, memberAfterInsert: Element) -func update(with: Element) -> Element? -func update(Element, at: Index) -> Element +mutating func insert(Element) -> (inserted: Bool, memberAfterInsert: Element) +mutating func update(with: Element) -> Element? +mutating func update(Element, at: Index) -> Element ``` #### Removing Elements ```swift -func remove(Element) -> Element? -func remove(at: Index) -> Element +mutating func remove(Element) -> Element? +mutating func remove(at: Index) -> Element func filter((Element) throws -> Bool) rethrows -> ShareableSet mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ``` @@ -171,21 +171,21 @@ func symmetricDifference(`Self`) -> ShareableSet func symmetricDifference(ShareableDictionary.Keys) -> ShareableSet func symmetricDifference(S) -> ShareableSet -func formIntersection(`Self`) -func formIntersection(ShareableDictionary.Keys) -func formIntersection(S) +mutating func formIntersection(`Self`) +mutating func formIntersection(ShareableDictionary.Keys) +mutating func formIntersection(S) -func formUnion(`Self`) -func formUnion(ShareableDictionary.Keys) -func formUnion(S) +mutating func formUnion(`Self`) +mutating func formUnion(ShareableDictionary.Keys) +mutating func formUnion(S) -func subtract(`Self`) -func subtract(ShareableDictionary.Keys) -func subtract(S) +mutating func subtract(`Self`) +mutating func subtract(ShareableDictionary.Keys) +mutating func subtract(S) -func formSymmetricDifference(`Self`) -func formSymmetricDifference(ShareableDictionary.Keys) -func formSymmetricDifference(S) +mutating func formSymmetricDifference(`Self`) +mutating func formSymmetricDifference(ShareableDictionary.Keys) +mutating func formSymmetricDifference(S) ``` #### Comparing Sets @@ -293,12 +293,12 @@ func index(forKey: Key) -> Index? Beyond the standard `updateValue(_:forKey:)` method, `ShareableDictionary` also provides additional `updateValue` variants that take closure arguments. These provide a more straightforward way to perform in-place mutations on dictionary values (compared to mutating values through the corresponding subscript operation.) `ShareableDictionary` also provides the standard `merge` and `merging` operations for combining dictionary values. ```swift -func updateValue(Value, forKey: Key) -> Value? -func updateValue(forKey: Key, with: (inout Value?) throws -> R) rethrows -> R -func updateValue(forKey: Key, default: () -> Value, with: (inout Value) throws -> R) rethrows -> R +mutating func updateValue(Value, forKey: Key) -> Value? +mutating func updateValue(forKey: Key, with: (inout Value?) throws -> R) rethrows -> R +mutating func updateValue(forKey: Key, default: () -> Value, with: (inout Value) throws -> R) rethrows -> R -func merge(`Self`, uniquingKeysWith: (Value, Value) throws -> Value) rethrows -func merge(S, uniquingKeysWith: (Value, Value) throws -> Value) rethrows +mutating func merge(`Self`, uniquingKeysWith: (Value, Value) throws -> Value) rethrows +mutating func merge(S, uniquingKeysWith: (Value, Value) throws -> Value) rethrows func merging(`Self`, uniquingKeysWith: (Value, Value) throws -> Value) rethrows -> ShareableDictionary func merging(S, uniquingKeysWith: (Value, Value) throws -> Value) rethrows -> ShareableDictionary @@ -307,8 +307,8 @@ func merging(S, uniquingKeysWith: (Value, Value) throws -> Value) rethrows -> #### Removing Keys and Values ```swift -func removeValue(forKey: Key) -> Value? -func remove(at: Index) -> Element +mutating func removeValue(forKey: Key) -> Value? +mutating func remove(at: Index) -> Element func filter((Element) throws -> Bool) rethrows -> ShareableDictionary mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows ```