Skip to main content

AllSender

Struct AllSender 

Source
pub struct AllSender<T> { /* private fields */ }
Expand description

可克隆(Clone)的全部交值句柄(sender handle)。

每份有效句柄占一个结果位置,消耗自身交值或无值释放均只结束本份。 接收关闭后的克隆只保留关闭错误,不新增位置。 T: Send 时可跨线程使用,不额外要求 T: Sync。

Implementations§

Source§

impl<T> AllSender<T>

Source

pub fn send(self, value: T) -> Result<(), SendError<T>>

同步交出本份位置的原值并消耗句柄(handle)。

成功只表示本位置已经接受原值,不表示其它参与方已结束或等待端已观察结果。 接收先关闭时,以 SendErrorKind::ReceiverClosed 返还同一个原值。 不等待其它发送方,不额外分配;条件原子更新(CAS)可因真实竞争重试。

通知和原值清理可以执行用户代码;其恐慌(panic)传播, 已接受事实不因此回退,用户回调耗时不属于非阻塞保证。

Trait Implementations§

Source§

impl<T> Clone for AllSender<T>

Source§

fn clone(&self) -> AllSender<T>

登记一份独立交值位置,顺序由并发登记成功点决定。

有效克隆(Clone)分配一个新结果槽;先观察到关闭则只复制关闭原因, 不分配、不增加位置。关闭竞争中尚未发布的预留会撤销。 本库数量或容量越界在新份发布前回滚预留并恐慌(panic); 标准共享分配及引用数量的失败仍沿标准库行为。

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Drop for AllSender<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for AllSender<T>

§

impl<T> !UnwindSafe for AllSender<T>

§

impl<T> Forget for AllSender<T>

§

impl<T> Freeze for AllSender<T>
where AllSenderState<T>: Freeze,

§

impl<T> Move for AllSender<T>

§

impl<T> Send for AllSender<T>
where AllSenderState<T>: Send,

§

impl<T> Sync for AllSender<T>
where AllSenderState<T>: Sync,

§

impl<T> Unpin for AllSender<T>
where AllSenderState<T>: Unpin,

§

impl<T> UnsafeUnpin for AllSender<T>
where AllSenderState<T>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OpaqueAttachment for T
where T: Send + Sync + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.