Receiver
public final class Receiver<C> : Cancellable where C : ChannelProtocol
-
Declaration
Swift
public typealias Item = C.Buffer.Item
-
Receives the next available item from the channel.
Return Value
Result.success(Item)
if the channel is not empty.Result.success(nil)
if the channel is empty.Result.failure
if the channel is closed and empty.
-
Closes the channel, preventing senders from sending new items.
Items sent before a call to this function can still be consumed by the receiver, until the channel is flushed. After the last item is consumed, subsequent attempts to receive an item will fail with
Channel.Error.cancelled
.It is acceptable to call this method more than once; subsequent calls are just ignored.
Declaration
Swift
@inlinable public func cancel()
-
Declaration
Swift
public struct StreamType : StreamProtocol, Cancellable
-
Declaration
Swift
@inlinable public func makeStream() -> StreamType