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 1
1
# 並行処理\( Concurrency\)
2
2
3
- 最終更新日: 2025/05/31
3
+ 最終更新日: 2025/06/28
4
4
原文: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html
5
5
6
6
非同期操作を行う。
@@ -497,12 +497,15 @@ struct TemperatureReading {
497
497
}
498
498
```
499
499
500
- ` Sendable ` プロトコルへの暗黙の準拠を上書きするには、` ~ Sendable` と書きます :
500
+ ` Sendable ` プロトコルへの暗黙の準拠を上書きするには、` Sendable ` への unavailable 準拠を書きます :
501
501
502
502
``` swift
503
- struct FileDescriptor : ~ Sendable {
503
+ struct FileDescriptor {
504
504
let rawValue: Int
505
505
}
506
+
507
+ @available (* , unavailable )
508
+ extension FileDescriptor : Sendable {}
506
509
```
507
510
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 1
1
# プロトコル\( Protocols\)
2
2
3
- 最終更新日: 2025/5/24
3
+ 最終更新日: 2025/6/28
4
4
原文: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html
5
5
6
6
準拠型が実装する必要がある要件を定義する。
@@ -560,7 +560,7 @@ struct FileDescriptor: ~Sendable {
560
560
561
561
``` swift
562
562
@available (* , unavailable )
563
- extension FileDescriptor Sendable { }
563
+ extension FileDescriptor : Sendable { }
564
564
```
565
565
566
566
前の例のように、コードのある場所で ` ~Sendable ` と記述した場合でも、プログラムの他の場所のコードは ` FileDescriptor ` 型を拡張して ` Sendable ` 準拠を追加できます。対照的に、この例の ` unavailable ` extension は、` Sendable ` への暗黙的な準拠を抑制し、さらにコードの他の場所にある extension がその型に ` Sendable ` 準拠を追加するのを防ぎます。
You can’t perform that action at this time.
0 commit comments