Skip to content

Commit 5a1e66f

Browse files
committed
[Concurrency] Hashable funcs should be inlinable for AsyncStream
1 parent 36ed9e1 commit 5a1e66f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

stdlib/public/Concurrency/AsyncStream.swift

+5
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public struct AsyncStream<Element> {
177177
case bufferingNewest(Int)
178178
}
179179

180+
@usableFromInline
180181
let storage: _Storage
181182

182183
/// Resume the task awaiting the next iteration point by having it return
@@ -478,14 +479,18 @@ extension AsyncStream.Continuation.YieldResult: Sendable where Element: Sendable
478479
@available(SwiftStdlib 6.2, *)
479480
extension AsyncStream.Continuation: Hashable {
480481
@available(SwiftStdlib 6.2, *)
482+
@inlinable
481483
public func hash(into hasher: inout Hasher) {
482484
return hasher.combine(ObjectIdentifier(storage))
483485
}
484486
@available(SwiftStdlib 6.2, *)
487+
@inlinable
485488
public var hashValue: Int {
486489
return _hashValue(for: self)
487490
}
491+
@inlinable
488492
@available(SwiftStdlib 6.2, *)
493+
@inlinable
489494
public static func == (lhs: Self, rhs: Self) -> Bool {
490495
return lhs.storage === rhs.storage
491496
}

stdlib/public/Concurrency/AsyncStreamBuffer.swift

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func _unlock(_ ptr: UnsafeRawPointer)
5555
@available(SwiftStdlib 5.1, *)
5656
extension AsyncStream {
5757
@safe
58+
@usableFromInline
5859
internal final class _Storage: @unchecked Sendable {
5960
typealias TerminationHandler = @Sendable (Continuation.Termination) -> Void
6061

@@ -281,6 +282,7 @@ extension AsyncStream {
281282
@available(SwiftStdlib 5.1, *)
282283
extension AsyncThrowingStream {
283284
@safe
285+
@usableFromInline
284286
internal final class _Storage: @unchecked Sendable {
285287
typealias TerminationHandler = @Sendable (Continuation.Termination) -> Void
286288
enum Terminal {

stdlib/public/Concurrency/AsyncThrowingStream.swift

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ public struct AsyncThrowingStream<Element, Failure: Error> {
199199
case bufferingNewest(Int)
200200
}
201201

202+
@usableFromInline
202203
let storage: _Storage
203204

204205
/// Resume the task awaiting the next iteration point by having it return
@@ -524,14 +525,17 @@ extension AsyncThrowingStream.Continuation.YieldResult: Sendable where Element:
524525
@available(SwiftStdlib 6.2, *)
525526
extension AsyncThrowingStream.Continuation: Hashable {
526527
@available(SwiftStdlib 6.2, *)
528+
@inlinable
527529
public func hash(into hasher: inout Hasher) {
528530
return hasher.combine(ObjectIdentifier(storage))
529531
}
530532
@available(SwiftStdlib 6.2, *)
533+
@inlinable
531534
public var hashValue: Int {
532535
return _hashValue(for: self)
533536
}
534537
@available(SwiftStdlib 6.2, *)
538+
@inlinable
535539
public static func == (lhs: Self, rhs: Self) -> Bool {
536540
return lhs.storage === rhs.storage
537541
}

0 commit comments

Comments
 (0)