Created
August 17, 2020 12:58
-
-
Save Sajjon/57b3487d11f293ec1cabdb89a4def9cf to your computer and use it in GitHub Desktop.
A suite of jobs piped together.
This file contains hidden or 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
struct Pipeline<Input, Output>: Job, CustomStringConvertible { | |
let description: String | |
private let _getOutput: (Input) throws -> Output | |
init(description: String, _ getOutput: @escaping (Input) throws -> Output) { | |
self.description = description | |
self._getOutput = getOutput | |
} | |
} | |
// MARK: Job | |
extension Pipeline { | |
func work(input: Input) throws -> Output { | |
return try _getOutput(input) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment