StreamingTask.swift 413 B

123456789101112131415161718
  1. struct StreamingTask<T> {
  2. let parameters: T
  3. let sink: EventSink?
  4. init(parameters: T) {
  5. self.parameters = parameters
  6. self.sink = nil
  7. }
  8. private init(parameters: T, sink: EventSink?) {
  9. self.parameters = parameters
  10. self.sink = sink
  11. }
  12. func with(sink: EventSink?) -> StreamingTask {
  13. return StreamingTask(parameters: parameters, sink: sink)
  14. }
  15. }