Skip to content

Commit 06bb718

Browse files
committed
[Concurrency] Hashable funcs should be inlinable for AsyncStream
1 parent 1bff8cd commit 06bb718

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

stdlib/public/Concurrency/AsyncStream.swift

Lines changed: 4 additions & 0 deletions
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
@@ -477,14 +478,17 @@ extension AsyncStream.Continuation.YieldResult: Sendable where Element: Sendable
477478

478479
@available(SwiftStdlib 6.2, *)
479480
extension AsyncStream.Continuation: Hashable {
481+
@inlinable
480482
@available(SwiftStdlib 6.2, *)
481483
public func hash(into hasher: inout Hasher) {
482484
return hasher.combine(ObjectIdentifier(storage))
483485
}
486+
@inlinable
484487
@available(SwiftStdlib 6.2, *)
485488
public var hashValue: Int {
486489
return _hashValue(for: self)
487490
}
491+
@inlinable
488492
@available(SwiftStdlib 6.2, *)
489493
public static func == (lhs: Self, rhs: Self) -> Bool {
490494
return lhs.storage === rhs.storage

stdlib/public/Concurrency/AsyncStreamBuffer.swift

Lines changed: 2 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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
@@ -523,14 +524,17 @@ extension AsyncThrowingStream.Continuation.YieldResult: Sendable where Element:
523524

524525
@available(SwiftStdlib 6.2, *)
525526
extension AsyncThrowingStream.Continuation: Hashable {
527+
@inlinable
526528
@available(SwiftStdlib 6.2, *)
527529
public func hash(into hasher: inout Hasher) {
528530
return hasher.combine(ObjectIdentifier(storage))
529531
}
532+
@inlinable
530533
@available(SwiftStdlib 6.2, *)
531534
public var hashValue: Int {
532535
return _hashValue(for: self)
533536
}
537+
@inlinable
534538
@available(SwiftStdlib 6.2, *)
535539
public static func == (lhs: Self, rhs: Self) -> Bool {
536540
return lhs.storage === rhs.storage

0 commit comments

Comments
 (0)