WithValueSender

Struct WithValueSender 

Source
pub struct WithValueSender<T: IsSender> { /* private fields */ }
Expand description

A wrapper around a sender, which provides a default with-value.

Implementations§

Source§

impl<T: IsSender> WithValueSender<T>

Source

pub fn new(sender: T, with: T::With) -> Self

Source

pub fn into_inner(self) -> (T, T::With)

Source

pub fn inner_ref(&self) -> (&T, &T::With)

Source

pub fn inner_mut(&mut self) -> (&mut T, &mut T::With)

Trait Implementations§

Source§

impl<T> Clone for WithValueSender<T>
where T: Clone + IsSender, T::With: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> IsSender for WithValueSender<T>
where T: IsSender,

Source§

type With = ()

The value that must be passed along when sending a message.
Source§

fn is_closed(&self) -> bool

Returns true if the channel is closed.
Source§

fn capacity(&self) -> Option<usize>

Returns the capacity of the channel, if it is bounded.
Source§

fn len(&self) -> usize

Returns the number of messages in the channel.
Source§

fn receiver_count(&self) -> usize

Returns the number of receivers in the channel.
Source§

fn sender_count(&self) -> usize

Returns the number of senders in the channel.
Source§

impl<T> SendsProtocol for WithValueSender<T>
where T: SendsProtocol, T::With: Clone,

Source§

type Protocol = <T as SendsProtocol>::Protocol

The protocol that can be sent to this sender.
Source§

fn send_protocol_with( this: &Self, protocol: Self::Protocol, with: (), ) -> impl Future<Output = Result<(), SendError<(Self::Protocol, Self::With)>>> + Send

Source§

fn try_send_protocol_with( this: &Self, protocol: Self::Protocol, with: (), ) -> Result<(), TrySendError<(Self::Protocol, Self::With)>>

Source§

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>
where T: Freeze, <T as IsSender>::With: Freeze,

§

impl<T> RefUnwindSafe for WithValueSender<T>

§

impl<T> Send for WithValueSender<T>
where T: Send, <T as IsSender>::With: Send,

§

impl<T> Sync for WithValueSender<T>
where T: Sync, <T as IsSender>::With: Sync,

§

impl<T> Unpin for WithValueSender<T>
where T: Unpin, <T as IsSender>::With: Unpin,

§

impl<T> UnwindSafe for WithValueSender<T>
where T: UnwindSafe, <T as IsSender>::With: UnwindSafe,

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> DynSendsExt for T
where T: DynSends,

Source§

fn accepts(&self, msg_id: TypeId) -> bool

Check if the sender accepts a message.
Source§

fn into_boxed(self) -> Box<dyn DynSends<With = Self::With>>
where Self: Sized,

Convert the sender into a boxed sender.
Source§

fn into_dyn<A>(self) -> DynSender<A, Self::With>
where Self: SendsProtocol, A: SubsetOf<Self::Protocol>,

Convert the sender into a DynSender.
Source§

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>
where Self: SendsProtocol, Self::With: Clone,

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>
where Self: SendsProtocol + Send + Sync,

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
where M: Send + 'static, Self::With: Send + 'static,

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)>>
where M: Send + 'static, Self::With: Send + 'static,

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)>>
where M: Send + 'static, Self::With: Send + 'static,

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
where M: Send + 'static, Self::With: Default + Send + 'static,

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>>
where M: Send + 'static, Self::With: Default + Send + 'static,

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>>
where M: Send + 'static, Self::With: Default + Send + 'static,

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
where M: Send + 'static + Message, Self::With: Send + 'static, M::Output: 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)>>
where M: Send + 'static + Message, Self::With: Send + 'static, M::Output: Send,

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)>>
where M: Send + 'static + Message, Self::With: Send + 'static, M::Output: Send,

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
where M: Send + 'static + Message, Self::With: Default + Send + 'static, M::Output: 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>>
where M: Send + 'static + Message, Self::With: Default + Send + 'static, M::Output: Send,

Like SendsExt::send_blocking_with, but fails if the message is not accepted by the protocol.
Source§

fn dyn_try_send<M>( &self, msg: impl Into<M::Input>, ) -> Result<M::Output, DynTrySendError<M::Input>>
where M: Send + 'static + Message, Self::With: Default + Send + 'static, M::Output: Send,

Like SendsExt::try_send_with, but fails if the message is not accepted by the protocol.
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<M, T> Sends<M> for T
where T: SendsProtocol, <T as SendsProtocol>::Protocol: From<M> + TryInto<M>,

Source§

fn send_msg_with( this: &T, msg: M, with: <T as IsSender>::With, ) -> impl Future<Output = Result<(), SendError<(M, <T as IsSender>::With)>>> + Send

Source§

fn send_msg_blocking_with( this: &T, msg: M, with: <T as IsSender>::With, ) -> Result<(), SendError<(M, <T as IsSender>::With)>>

Source§

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
where T: IsSender + ?Sized,

Source§

fn send_msg_with<M>( &self, msg: M, with: Self::With, ) -> impl Future<Output = Result<(), SendError<(M, Self::With)>>> + Send
where 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>,

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>,

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
where Self: Sends<M>, Self::With: Default,

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>>
where Self: Sends<M>, Self::With: Default,

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>>
where Self: Sends<M>, Self::With: Default,

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
where Self: Sends<M>, M::Output: 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>,

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>,

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
where Self: Sends<M>, Self::With: Default,

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>>
where Self: Sends<M>, Self::With: Default,

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>>
where Self: Sends<M>, Self::With: Default,

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
where Self: Sends<M>, M::Output: ResultFuture,

Send a message with a custom value, waiting asynchronously until space becomes available, and then await the Message::Output. Read more
Source§

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
where Self: Sends<M>, Self::With: Default, M::Output: ResultFuture,

Send a message using a default value, blocking the current thread until space becomes available, and then await the Message::Output. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T, S> SupersetOf<S> for T
where S: SubsetOf<T>,

Source§

impl<S> Zero for S
where S: ?Sized,