Sender
public final class Sender<C> : Cancellable where C : ChannelProtocol
-
Declaration
Swift
public typealias Item = C.Buffer.Item
-
Declaration
Swift
@inlinable public var capacity: Int { get }
-
Sends
item
into the channel.Return Value
Result.success(true)
ifitem
was sent successfully.Result.success(false)
if the channel is at capacity.Result.failure
if the channel is closed.
-
Return Value
Result.success(true)
if the channel is empty.Result.success(false)
if the channel is not empty.Result.failure
if the channel is closed.
-
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()
-
Sends
item
into the channel.Declaration
Return Value
Result.success
ifitem
was sent successfully.Result.failure
if the channel is closed.
-
Declaration
Swift
public struct SinkType : SinkProtocol
-
Declaration
Swift
@inlinable public func makeSink() -> SinkType