pub struct Sender<T: State = TaskCompletion> { /* private fields */ }Expand description
Completion notifier for one-shot tasks
Optimized implementation using AtomicPtr
- Faster creation than Notify (no waitlist allocation) or AtomicWaker (no state machine)
- Lower memory footprint (just two atomic fields)
- Direct waker management without intermediate futures
- Single Arc allocation for both sender and receiver
一次性任务完成通知器
使用 AtomicPtr
- 比 Notify(无等待列表分配)或 AtomicWaker(无状态机)创建更快
- 更小的内存占用(仅两个原子字段)
- 直接管理 waker,无中间 future
- 发送器和接收器共享单个 Arc 分配
Implementations§
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> RefUnwindSafe for Sender<T>where
T: RefUnwindSafe,
impl<T> Send for Sender<T>
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> UnwindSafe for Sender<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more