Sender

struct Sender<T>

A clonable sending endpoint for an unbounded, multi-producer channel.

Each explicit clone registers another logical sender; the receiver observes closure only after every sender is dropped. Values transfer across workers, so T must satisfy Send. Sending never waits for capacity.

Methods

func send(consume value: T) -> Void

Transfers value to the receiver without backpressure.

If the receiver has already been dropped, the value is discarded through typed drop glue. Compare BoundedSender.send, which can wait and reports whether delivery won the race with receiver closure.

View Source
pub func send(consume value: T) -> Void {
	// The runtime queue is untyped, so only Talk code can release a
	// value nobody will ever take: a send to a dead receiver drops
	// the value here instead of enqueueing it.
	if _chan_ctl(handle: self.handle, op: 9) == 1 {
		_chan_send(handle: self.handle, value: value)
	}
}