pub struct UseChannel<MessageType: Clone + 'static> { /* private fields */ }
Expand description
Send and listen for messages between multiple components.
Implementations§
Source§impl<MessageType: Clone + 'static> UseChannel<MessageType>
impl<MessageType: Clone + 'static> UseChannel<MessageType>
Sourcepub fn try_send(
&self,
msg: impl Into<MessageType>,
) -> Result<(), TrySendError<MessageType>>
pub fn try_send( &self, msg: impl Into<MessageType>, ) -> Result<(), TrySendError<MessageType>>
Tries to send a message to all listeners of the channel.
Sourcepub async fn send(
&self,
msg: impl Into<MessageType>,
) -> Result<(), SendError<MessageType>>
pub async fn send( &self, msg: impl Into<MessageType>, ) -> Result<(), SendError<MessageType>>
Sends a message to all listeners of the channel.
Sourcepub fn receiver(&mut self) -> Receiver<MessageType>
pub fn receiver(&mut self) -> Receiver<MessageType>
Create a receiver for the channel.
You probably want to use super::use_listen_channel()
.
Trait Implementations§
Source§impl<MessageType: Clone + Clone + 'static> Clone for UseChannel<MessageType>
impl<MessageType: Clone + Clone + 'static> Clone for UseChannel<MessageType>
Source§fn clone(&self) -> UseChannel<MessageType>
fn clone(&self) -> UseChannel<MessageType>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Clone> PartialEq for UseChannel<T>
impl<T: Clone> PartialEq for UseChannel<T>
impl<MessageType: Copy + Clone + 'static> Copy for UseChannel<MessageType>
Auto Trait Implementations§
impl<MessageType> Freeze for UseChannel<MessageType>
impl<MessageType> !RefUnwindSafe for UseChannel<MessageType>
impl<MessageType> !Send for UseChannel<MessageType>
impl<MessageType> !Sync for UseChannel<MessageType>
impl<MessageType> Unpin for UseChannel<MessageType>
impl<MessageType> !UnwindSafe for UseChannel<MessageType>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.