-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from noppoMan/escaping-closure
make completion closures @escaping
- Loading branch information
Showing
5 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
public protocol AsyncConnection: AsyncStream { | ||
func open(timingOut deadline: Double, completion: ((Void) throws -> AsyncConnection) -> Void) throws | ||
func open(timingOut deadline: Double, completion: @escaping ((Void) throws -> AsyncConnection) -> Void) throws | ||
} | ||
|
||
extension AsyncConnection { | ||
public func open(completion: ((Void) throws -> AsyncConnection) -> Void) throws { | ||
public func open(completion: @escaping ((Void) throws -> AsyncConnection) -> Void) throws { | ||
try open(timingOut: .never, completion: completion) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
public protocol AsyncHost { | ||
func accept(timingOut deadline: Double, completion: ((Void) throws -> AsyncStream) -> Void) | ||
func accept(timingOut deadline: Double, completion: @escaping ((Void) throws -> AsyncStream) -> Void) | ||
} | ||
|
||
extension AsyncHost { | ||
public func accept(completion: ((Void) throws -> AsyncStream) -> Void) { | ||
public func accept(completion: @escaping ((Void) throws -> AsyncStream) -> Void) { | ||
accept(timingOut: .never, completion: completion) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
public protocol AsyncSending { | ||
func send(_ data: Data, timingOut deadline: Double, completion: ((Void) throws -> Void) -> Void) | ||
func flush(timingOut deadline: Double, completion: ((Void) throws -> Void) -> Void) | ||
func send(_ data: Data, timingOut deadline: Double, completion: @escaping ((Void) throws -> Void) -> Void) | ||
func flush(timingOut deadline: Double, completion: @escaping ((Void) throws -> Void) -> Void) | ||
} | ||
|
||
public protocol AsyncReceiving { | ||
func receive(upTo byteCount: Int, timingOut deadline: Double, completion: ((Void) throws -> Data) -> Void) | ||
func receive(upTo byteCount: Int, timingOut deadline: Double, completion: @escaping ((Void) throws -> Data) -> Void) | ||
} | ||
|
||
public protocol AsyncSendingStream: Closable, AsyncSending {} | ||
public protocol AsyncReceivingStream: Closable, AsyncReceiving {} | ||
public protocol AsyncStream: AsyncSendingStream, AsyncReceivingStream {} | ||
|
||
extension AsyncSending { | ||
public func send(_ data: Data, completion: ((Void) throws -> Void) -> Void) { | ||
public func send(_ data: Data, completion: @escaping ((Void) throws -> Void) -> Void) { | ||
send(data, timingOut: .never, completion: completion) | ||
} | ||
public func flush(completion: ((Void) throws -> Void) -> Void) { | ||
public func flush(completion: @escaping ((Void) throws -> Void) -> Void) { | ||
flush(timingOut: .never, completion: completion) | ||
} | ||
} | ||
|
||
extension AsyncReceiving { | ||
public func receive(upTo byteCount: Int, completion: ((Void) throws -> Data) -> Void) { | ||
public func receive(upTo byteCount: Int, completion: @escaping ((Void) throws -> Data) -> Void) { | ||
receive(upTo: byteCount, timingOut: .never, completion: completion) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters