Skip to content

Commit 1cfef25

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

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

stdlib/public/Concurrency/AsyncStream.swift

+7
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,15 +478,21 @@ 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, *)
483+
@inlinable
481484
public func hash(into hasher: inout Hasher) {
482485
return hasher.combine(ObjectIdentifier(storage))
483486
}
487+
@inlinable
484488
@available(SwiftStdlib 6.2, *)
489+
@inlinable
485490
public var hashValue: Int {
486491
return _hashValue(for: self)
487492
}
493+
@inlinable
488494
@available(SwiftStdlib 6.2, *)
495+
@inlinable
489496
public static func == (lhs: Self, rhs: Self) -> Bool {
490497
return lhs.storage === rhs.storage
491498
}

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

+7
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,15 +524,21 @@ 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, *)
529+
@inlinable
527530
public func hash(into hasher: inout Hasher) {
528531
return hasher.combine(ObjectIdentifier(storage))
529532
}
533+
@inlinable
530534
@available(SwiftStdlib 6.2, *)
535+
@inlinable
531536
public var hashValue: Int {
532537
return _hashValue(for: self)
533538
}
539+
@inlinable
534540
@available(SwiftStdlib 6.2, *)
541+
@inlinable
535542
public static func == (lhs: Self, rhs: Self) -> Bool {
536543
return lhs.storage === rhs.storage
537544
}

0 commit comments

Comments
 (0)