SendOnly

public final class SendOnly : Handle

Send-only reference to an existing channel.

Example:

let channel = Channel<Int>()

func send(to channel: Channel<Int>.SendOnly) throws {
    try channel.send(42, deadline: 1.second.fromNow())
}

try send(to: channel.sendOnly)
  • Sends a value to the channel.

    Declaration

    Swift

    public func send(_ value: Type, deadline: Deadline) throws
  • Sends an error to the channel.

    Declaration

    Swift

    public func send(_ error: Error, deadline: Deadline) throws
  • Mark the channel as done. When a channel is marked as done it cannot receive or send anymore.

    Declaration

    Swift

    public func done() throws