File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 11# 並行処理\( Concurrency\)
22
3- 最終更新日: 2025/05/31
3+ 最終更新日: 2025/06/28
44原文: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html
55
66非同期操作を行う。
@@ -497,12 +497,15 @@ struct TemperatureReading {
497497}
498498```
499499
500- ` Sendable ` プロトコルへの暗黙の準拠を上書きするには、` ~ Sendable` と書きます :
500+ ` Sendable ` プロトコルへの暗黙の準拠を上書きするには、` Sendable ` への unavailable 準拠を書きます :
501501
502502``` swift
503- struct FileDescriptor : ~ Sendable {
503+ struct FileDescriptor {
504504 let rawValue: Int
505505}
506+
507+ @available (* , unavailable )
508+ extension FileDescriptor : Sendable {}
506509```
507510
508- プロトコルへの暗黙の準拠を抑制する詳細な情報は、 [ 暗黙の制約 \( Implicit Constraints \) ] ( ./generics .md#暗黙の制約implicit-constraints ) を参照ください 。
511+ unavailable 準拠を使用して、 [ プロトコルへの暗黙の準拠 \( Implicit Conformance to a Protocol \) ] ( ./protocols .md#プロトコルへの暗黙の準拠implicit-conformance-to-a-protocol ) で説明されているように、プロトコルに対する暗黙的な準拠を抑制することもできます 。
Original file line number Diff line number Diff line change 11# プロトコル\( Protocols\)
22
3- 最終更新日: 2025/5/24
3+ 最終更新日: 2025/6/28
44原文: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html
55
66準拠型が実装する必要がある要件を定義する。
@@ -560,7 +560,7 @@ struct FileDescriptor: ~Sendable {
560560
561561``` swift
562562@available (* , unavailable )
563- extension FileDescriptor Sendable { }
563+ extension FileDescriptor : Sendable { }
564564```
565565
566566前の例のように、コードのある場所で ` ~Sendable ` と記述した場合でも、プログラムの他の場所のコードは ` FileDescriptor ` 型を拡張して ` Sendable ` 準拠を追加できます。対照的に、この例の ` unavailable ` extension は、` Sendable ` への暗黙的な準拠を抑制し、さらにコードの他の場所にある extension がその型に ` Sendable ` 準拠を追加するのを防ぎます。
You can’t perform that action at this time.
0 commit comments