pub struct WithValueSender<T: IsSender> { /* private fields */ }Expand description
A wrapper around a sender, which provides a default with-value.
Implementations§
Trait Implementations§
Source§impl<T> Clone for WithValueSender<T>
impl<T> Clone for WithValueSender<T>
Source§impl<T> IsSender for WithValueSender<T>where
T: IsSender,
impl<T> IsSender for WithValueSender<T>where
T: IsSender,
Source§fn receiver_count(&self) -> usize
fn receiver_count(&self) -> usize
Returns the number of receivers in the channel.
Source§fn sender_count(&self) -> usize
fn sender_count(&self) -> usize
Returns the number of senders in the channel.
Source§impl<T> SendsProtocol for WithValueSender<T>
impl<T> SendsProtocol for WithValueSender<T>
Source§type Protocol = <T as SendsProtocol>::Protocol
type Protocol = <T as SendsProtocol>::Protocol
The protocol that can be sent to this sender.
fn send_protocol_with( this: &Self, protocol: Self::Protocol, with: (), ) -> impl Future<Output = Result<(), SendError<(Self::Protocol, Self::With)>>> + Send
fn try_send_protocol_with( this: &Self, protocol: Self::Protocol, with: (), ) -> Result<(), TrySendError<(Self::Protocol, Self::With)>>
fn send_protocol_blocking_with( this: &Self, protocol: Self::Protocol, with: Self::With, ) -> Result<(), SendError<(Self::Protocol, Self::With)>>
Auto Trait Implementations§
impl<T> Freeze for WithValueSender<T>
impl<T> RefUnwindSafe for WithValueSender<T>
impl<T> Send for WithValueSender<T>
impl<T> Sync for WithValueSender<T>
impl<T> Unpin for WithValueSender<T>
impl<T> UnwindSafe for WithValueSender<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynSendsExt for Twhere
T: DynSends,
impl<T> DynSendsExt for Twhere
T: DynSends,
Source§fn into_boxed(self) -> Box<dyn DynSends<With = Self::With>>where
Self: Sized,
fn into_boxed(self) -> Box<dyn DynSends<With = Self::With>>where
Self: Sized,
Convert the sender into a boxed sender.
Source§fn into_dyn_unchecked<A>(self) -> DynSender<A, Self::With>where
Self: SendsProtocol,
fn into_dyn_unchecked<A>(self) -> DynSender<A, Self::With>where
Self: SendsProtocol,
Convert the sender into a
DynSender, without checking if the protocol accepts the messages.Source§fn with(self, with: Self::With) -> WithValueSender<Self>
fn with(self, with: Self::With) -> WithValueSender<Self>
Map the
with value of the sender to (), by providing the default with to use.Source§fn map_with<W>(
self,
f1: fn(W) -> Self::With,
f2: fn(Self::With) -> W,
) -> MappedWithSender<Self, W>
fn map_with<W>( self, f1: fn(W) -> Self::With, f2: fn(Self::With) -> W, ) -> MappedWithSender<Self, W>
Map the
with value of the sender to W, by providing conversion functions.Source§fn dyn_send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> impl Future<Output = Result<(), DynSendError<(M, Self::With)>>> + Send
fn dyn_send_msg_with<M>( &self, msg: M, with: Self::With, ) -> impl Future<Output = Result<(), DynSendError<(M, Self::With)>>> + Send
Like
SendsExt::send_msg_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_msg_blocking_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), DynSendError<(M, Self::With)>>
fn dyn_send_msg_blocking_with<M>( &self, msg: M, with: Self::With, ) -> Result<(), DynSendError<(M, Self::With)>>
Like
SendsExt::send_msg_blocking_with, but fails if the message is not accepted by the protocol.Source§fn dyn_try_send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), DynTrySendError<(M, Self::With)>>
fn dyn_try_send_msg_with<M>( &self, msg: M, with: Self::With, ) -> Result<(), DynTrySendError<(M, Self::With)>>
Like
SendsExt::try_send_msg_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_msg<M>(
&self,
msg: M,
) -> impl Future<Output = Result<(), DynSendError<M>>> + Send
fn dyn_send_msg<M>( &self, msg: M, ) -> impl Future<Output = Result<(), DynSendError<M>>> + Send
Like
SendsExt::send_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_msg_blocking<M>(&self, msg: M) -> Result<(), DynSendError<M>>
fn dyn_send_msg_blocking<M>(&self, msg: M) -> Result<(), DynSendError<M>>
Like
SendsExt::send_blocking_with, but fails if the message is not accepted by the protocol.Source§fn dyn_try_send_msg<M>(&self, msg: M) -> Result<(), DynTrySendError<M>>
fn dyn_try_send_msg<M>(&self, msg: M) -> Result<(), DynTrySendError<M>>
Like
SendsExt::try_send_msg_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_with<M>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> impl Future<Output = Result<M::Output, DynSendError<(M::Input, Self::With)>>> + Send
fn dyn_send_with<M>( &self, msg: impl Into<M::Input>, with: Self::With, ) -> impl Future<Output = Result<M::Output, DynSendError<(M::Input, Self::With)>>> + Send
Like
SendsExt::send_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_blocking_with<M>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, DynSendError<(M::Input, Self::With)>>
fn dyn_send_blocking_with<M>( &self, msg: impl Into<M::Input>, with: Self::With, ) -> Result<M::Output, DynSendError<(M::Input, Self::With)>>
Like
SendsExt::send_blocking_with, but fails if the message is not accepted by the protocol.Source§fn dyn_try_send_with<M>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, DynTrySendError<(M::Input, Self::With)>>
fn dyn_try_send_with<M>( &self, msg: impl Into<M::Input>, with: Self::With, ) -> Result<M::Output, DynTrySendError<(M::Input, Self::With)>>
Like
SendsExt::try_send_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send<M>(
&self,
msg: impl Into<M::Input>,
) -> impl Future<Output = Result<M::Output, DynSendError<M::Input>>> + Send
fn dyn_send<M>( &self, msg: impl Into<M::Input>, ) -> impl Future<Output = Result<M::Output, DynSendError<M::Input>>> + Send
Like
SendsExt::send_with, but fails if the message is not accepted by the protocol.Source§fn dyn_send_blocking<M>(
&self,
msg: impl Into<M::Input>,
) -> Result<M::Output, DynSendError<M::Input>>
fn dyn_send_blocking<M>( &self, msg: impl Into<M::Input>, ) -> Result<M::Output, DynSendError<M::Input>>
Like
SendsExt::send_blocking_with, but fails if the message is not accepted by the protocol.Source§impl<M, T> Sends<M> for T
impl<M, T> Sends<M> for T
fn send_msg_with( this: &T, msg: M, with: <T as IsSender>::With, ) -> impl Future<Output = Result<(), SendError<(M, <T as IsSender>::With)>>> + Send
fn send_msg_blocking_with( this: &T, msg: M, with: <T as IsSender>::With, ) -> Result<(), SendError<(M, <T as IsSender>::With)>>
fn try_send_msg_with( this: &T, msg: M, with: <T as IsSender>::With, ) -> Result<(), TrySendError<(M, <T as IsSender>::With)>>
Source§impl<T> SendsExt for T
impl<T> SendsExt for T
Source§fn send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> impl Future<Output = Result<(), SendError<(M, Self::With)>>> + Sendwhere
Self: Sends<M>,
fn send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> impl Future<Output = Result<(), SendError<(M, Self::With)>>> + Sendwhere
Self: Sends<M>,
Send a message with a custom value, waiting asynchronously until space becomes available. Read more
Source§fn send_msg_blocking_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), SendError<(M, Self::With)>>where
Self: Sends<M>,
fn send_msg_blocking_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), SendError<(M, Self::With)>>where
Self: Sends<M>,
Send a message with a custom value, blocking the current thread until space becomes available. Read more
Source§fn try_send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), TrySendError<(M, Self::With)>>where
Self: Sends<M>,
fn try_send_msg_with<M>(
&self,
msg: M,
with: Self::With,
) -> Result<(), TrySendError<(M, Self::With)>>where
Self: Sends<M>,
Send a message with a custom value, returning an error if space is not available. Read more
Source§fn send_msg<M: Message>(
&self,
msg: M,
) -> impl Future<Output = Result<(), SendError<M>>> + Send
fn send_msg<M: Message>( &self, msg: M, ) -> impl Future<Output = Result<(), SendError<M>>> + Send
Send a message using a default value, waiting asynchronously until space becomes available. Read more
Source§fn send_msg_blocking<M: Message>(&self, msg: M) -> Result<(), SendError<M>>
fn send_msg_blocking<M: Message>(&self, msg: M) -> Result<(), SendError<M>>
Send a message using a default value, blocking the current thread until space becomes available. Read more
Source§fn try_send_msg<M: Message>(&self, msg: M) -> Result<(), TrySendError<M>>
fn try_send_msg<M: Message>(&self, msg: M) -> Result<(), TrySendError<M>>
Send a message using a default value, returning an error if space is not available. Read more
Source§fn send_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> impl Future<Output = Result<M::Output, SendError<(M::Input, Self::With)>>> + Send
fn send_with<M: Message>( &self, msg: impl Into<M::Input>, with: Self::With, ) -> impl Future<Output = Result<M::Output, SendError<(M::Input, Self::With)>>> + Send
Send a message with a custom value, waiting asynchronously until space becomes available. Read more
Source§fn send_blocking_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, SendError<(M::Input, Self::With)>>where
Self: Sends<M>,
fn send_blocking_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, SendError<(M::Input, Self::With)>>where
Self: Sends<M>,
Send a message with a custom value, blocking the current thread until space becomes available. Read more
Source§fn try_send_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, TrySendError<(M::Input, Self::With)>>where
Self: Sends<M>,
fn try_send_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> Result<M::Output, TrySendError<(M::Input, Self::With)>>where
Self: Sends<M>,
Send a message with a custom value, returning an error if space is not available. Read more
Source§fn send<M: Message>(
&self,
msg: impl Into<M::Input>,
) -> impl Future<Output = Result<M::Output, SendError<M::Input>>> + Send
fn send<M: Message>( &self, msg: impl Into<M::Input>, ) -> impl Future<Output = Result<M::Output, SendError<M::Input>>> + Send
Send a message using a default value, waiting asynchronously until space becomes available. Read more
Source§fn send_blocking<M: Message>(
&self,
msg: impl Into<M::Input>,
) -> Result<M::Output, SendError<M::Input>>
fn send_blocking<M: Message>( &self, msg: impl Into<M::Input>, ) -> Result<M::Output, SendError<M::Input>>
Send a message using a default value, blocking the current thread until space becomes available. Read more
Source§fn try_send<M: Message>(
&self,
msg: impl Into<M::Input>,
) -> Result<M::Output, TrySendError<M::Input>>
fn try_send<M: Message>( &self, msg: impl Into<M::Input>, ) -> Result<M::Output, TrySendError<M::Input>>
Send a message using a default value, returning an error if space is not available. Read more
Source§fn request_with<M: Message>(
&self,
msg: impl Into<M::Input>,
with: Self::With,
) -> impl Future<Output = Result<<M::Output as ResultFuture>::Ok, RequestError<(M::Input, Self::With), <M::Output as ResultFuture>::Error>>> + Send
fn request_with<M: Message>( &self, msg: impl Into<M::Input>, with: Self::With, ) -> impl Future<Output = Result<<M::Output as ResultFuture>::Ok, RequestError<(M::Input, Self::With), <M::Output as ResultFuture>::Error>>> + Send
Send a message with a custom value, waiting asynchronously until space becomes available, and then
await the
Message::Output. Read moreSource§fn request<M: Message>(
&self,
msg: impl Into<M::Input>,
) -> impl Future<Output = Result<<M::Output as ResultFuture>::Ok, RequestError<M::Input, <M::Output as ResultFuture>::Error>>> + Send
fn request<M: Message>( &self, msg: impl Into<M::Input>, ) -> impl Future<Output = Result<<M::Output as ResultFuture>::Ok, RequestError<M::Input, <M::Output as ResultFuture>::Error>>> + Send
Send a message using a default value, blocking the current thread until space becomes available, and then
await the
Message::Output. Read more