1313import _Concurrency
1414
1515/// The `Archiver` protocol abstracts away the different operations surrounding archives.
16- public protocol Archiver {
16+ public protocol Archiver : Sendable {
1717 /// A set of extensions the current archiver supports.
1818 var supportedExtensions : Set < String > { get }
1919
@@ -27,7 +27,7 @@ public protocol Archiver {
2727 func extract(
2828 from archivePath: AbsolutePath ,
2929 to destinationPath: AbsolutePath ,
30- completion: @escaping ( Result < Void , Error > ) -> Void
30+ completion: @escaping @ Sendable ( Result < Void , Error > ) -> Void
3131 )
3232
3333 /// Asynchronously compress the contents of a directory to a destination archive.
@@ -40,7 +40,7 @@ public protocol Archiver {
4040 func compress(
4141 directory: AbsolutePath ,
4242 to destinationPath: AbsolutePath ,
43- completion: @escaping ( Result < Void , Error > ) -> Void
43+ completion: @escaping @ Sendable ( Result < Void , Error > ) -> Void
4444 )
4545
4646 /// Asynchronously validates if a file is an archive.
@@ -51,7 +51,7 @@ public protocol Archiver {
5151 @available ( * , noasync, message: " Use the async alternative " )
5252 func validate(
5353 path: AbsolutePath ,
54- completion: @escaping ( Result < Bool , Error > ) -> Void
54+ completion: @escaping @ Sendable ( Result < Bool , Error > ) -> Void
5555 )
5656}
5757
@@ -65,8 +65,8 @@ extension Archiver {
6565 from archivePath: AbsolutePath ,
6666 to destinationPath: AbsolutePath
6767 ) async throws {
68- try await withCheckedThrowingContinuation {
69- self . extract ( from: archivePath, to: destinationPath, completion: $0 . resume ( with: ) )
68+ try await withCheckedThrowingContinuation { continuation in
69+ self . extract ( from: archivePath, to: destinationPath, completion: { continuation . resume ( with: $0 ) } )
7070 }
7171 }
7272
@@ -79,8 +79,8 @@ extension Archiver {
7979 directory: AbsolutePath ,
8080 to destinationPath: AbsolutePath
8181 ) async throws {
82- try await withCheckedThrowingContinuation {
83- self . compress ( directory: directory, to: destinationPath, completion: $0 . resume ( with: ) )
82+ try await withCheckedThrowingContinuation { continuation in
83+ self . compress ( directory: directory, to: destinationPath, completion: { continuation . resume ( with: $0 ) } )
8484 }
8585 }
8686
@@ -91,8 +91,8 @@ extension Archiver {
9191 public func validate(
9292 path: AbsolutePath
9393 ) async throws -> Bool {
94- try await withCheckedThrowingContinuation {
95- self . validate ( path: path, completion: $0 . resume ( with: ) )
94+ try await withCheckedThrowingContinuation { continuation in
95+ self . validate ( path: path, completion: { continuation . resume ( with: $0 ) } )
9696 }
9797 }
9898}
0 commit comments