Channel
public enum Channel
A namespace for types and convenience methods related to channels.
For details on channels, see ChannelProtocol
.
-
Bounded, single-slot, single-sender channel (AKA
See morerendez-vous
). Unbuffered channels are safe to use from any executor.Declaration
Swift
public enum Unbuffered<Item> : ChannelProtocol
-
Creates a bounded, single-slot, single-sender (AKA
rendez-vous
) channel. Unbuffered channels are safe to use from any executor.Declaration
Swift
@inlinable public static func makeUnbuffered<T>(itemType _: T.Type = T.self) -> Pipe<Unbuffered<T>>
-
Unbounded, single-slot, single-sender channel (AKA
See morepassthrough
). Passthrough channels must only be used from a single executor.Declaration
Swift
public enum Passthrough<Item> : UnboundedChannelProtocol
-
Creates an unbounded, single-slot, single-sender (AKA
passthrough
) channel. Passthrough channels must only be used from a single executor.Declaration
Swift
@inlinable public static func makePassthrough<T>(itemType _: T.Type = T.self) -> Pipe<Passthrough<T>>
-
Bounded, buffered, single-sender channel. Buffered channels are safe to use from any executor.
See moreDeclaration
Swift
public enum Buffered<Item> : ChannelProtocol
-
Creates a bounded, buffered, single-sender channel with the specified capacity. Buffered channels are safe to use from any executor.
Declaration
-
Unbounded, buffered, single-sender channel. Buffered channels are safe to use from any executor.
See moreDeclaration
Swift
public enum BufferedUnbounded<Item> : UnboundedChannelProtocol
-
Creates an unbounded, buffered, single-sender channel. Buffered channels are safe to use from any executor.
Declaration
Swift
@inlinable public static func makeBuffered<T>(itemType _: T.Type = T.self) -> Pipe<BufferedUnbounded<T>>
-
Bounded, buffered, multiple-sender channel. Shared channels are safe to use from any executor.
See moreDeclaration
Swift
public enum Shared<Item> : ChannelProtocol
-
Creates a bounded, buffered, multiple-sender channel with the specified capacity. Shared channels are safe to use from any executor.
Declaration
-
Unbounded, buffered, multiple-sender channel. Shared channels are safe to use from any executor.
See moreDeclaration
Swift
public enum SharedUnbounded<Item> : UnboundedChannelProtocol
-
Creates an unbounded, buffered, multiple-sender channel. Shared channels are safe to use from any executor.
Declaration
Swift
@inlinable public static func makeShared<T>(itemType _: T.Type = T.self) -> Pipe<SharedUnbounded<T>>
-
Declaration
Swift
public enum Error : Swift.Error, Hashable, Equatable
-
Bundles together the sending and receiving sides of a channel.
The channel is kept open for as long as the pipe is kept alive. You may obtain separate handles to each side using
Pipe.split()
, let the pipe go and manage each side lifetime separately. This is useful when the sender and receiver have different lifetimes; dropping either side closes the channel.
See morePipe
is typically known as Subject in other frameworks.Declaration
Swift
public struct Pipe<C> : SinkConvertible, StreamConvertible where C : ChannelProtocol
-
Declaration
Swift
public final class Sender<C> : Cancellable where C : ChannelProtocol
-
Declaration
Swift
public final class Receiver<C> : Cancellable where C : ChannelProtocol