struct Inner<T> {
state: AtomicUsize,
value: UnsafeCell<Option<T>>,
tx_task: Task,
rx_task: Task,
}
Fields§
§state: AtomicUsize
Manages the state of the inner cell.
value: UnsafeCell<Option<T>>
The value. This is set by Sender
and read by Receiver
. The state of
the cell is tracked by state
.
tx_task: Task
The task to notify when the receiver drops without consuming the value.
§Safety
The TX_TASK_SET
bit in the state
field is set if this field is
initialized. If that bit is unset, this field may be uninitialized.
rx_task: Task
The task to notify when the value is sent.
§Safety
The RX_TASK_SET
bit in the state
field is set if this field is
initialized. If that bit is unset, this field may be uninitialized.
Implementations§
source§impl<T> Inner<T>
impl<T> Inner<T>
fn complete(&self) -> bool
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>>
sourceunsafe fn consume_value(&self) -> Option<T>
unsafe fn consume_value(&self) -> Option<T>
Consumes the value. This function does not check state
.
§Safety
Calling this method concurrently on multiple threads will result in a
data race. The VALUE_SENT
state bit is used to ensure that only the
sender or the receiver will call this method at a given point in time.
If VALUE_SENT
is not set, then only the sender may call this method;
if it is set, then only the receiver may call this method.