BoundedChannel¶
Methods¶
capacity¶
Configured capacity at construction.
Returns
number
close¶
Close the channel. Subsequent :send / :try_send calls
fail; pending and future :recv calls drain remaining
values and then return nil. Idempotent.
Implemented by dropping the held Sender. When the
underlying tokio channel sees its last Sender go away it
wakes any parked receiver, which then drains buffered
values and returns None. This path deliberately does
not acquire the receiver's async mutex: doing so would
deadlock against an in-flight recv that holds the lock
across rx.recv().await.
is_closed¶
Returns true once the channel has been closed (no further
sends will succeed).
Returns
boolean
recv¶
Receive a value, awaiting until one is available. Returns
nil once the channel has been closed and drained. For
Map / Vec payloads the returned value is a read-only
snapshot proxy; pass through task.materialize for a
mutable Lua table copy.
Returns
any
send¶
Send a value, awaiting if the channel is full. Raises if the channel has been closed. The value is snapshotted before being placed in the channel; non-snapshottable inputs are rejected with an error during argument extraction.
Parameters
value:any
try_recv¶
Try to receive a value without awaiting. Returns the value
on success, or nil if the channel is empty or closed.
Returns
any
try_send¶
Try to send a value without awaiting. Returns true on
success or false if the channel is full. Raises if the
channel has been closed.
Parameters
value:any
Returns
boolean
Metamethods¶
__tostring¶
Returns
...any