From 1ac199c195744b42c014f720768bc3ee9efb1544 Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Fri, 14 Dec 2018 16:13:17 +0000 Subject: [PATCH] allow EventLoopIterator to be constructed using [EventLoop] (#706) Motivation: Modules outside of NIO core must be able to create `EventLoopIterator`s in order to conform to the `EventLoop` protocol, therefore we need an initialiser that's available. Modifications: add public initialiser to construct EventLoopIterator from [EventLoop] Result: others can implement EventLoops again --- Sources/NIO/EventLoop.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/NIO/EventLoop.swift b/Sources/NIO/EventLoop.swift index 838b9fde9..c077125cf 100644 --- a/Sources/NIO/EventLoop.swift +++ b/Sources/NIO/EventLoop.swift @@ -155,7 +155,8 @@ public struct EventLoopIterator: Sequence, IteratorProtocol { public typealias Element = EventLoop private var eventLoops: IndexingIterator<[EventLoop]> - internal init(_ eventLoops: [EventLoop]) { + /// Create an `EventLoopIterator` from an array of `EventLoop`s. + public init(_ eventLoops: [EventLoop]) { self.eventLoops = eventLoops.makeIterator() }