pub struct Scope<C: Component> { /* private fields */ }
Expand description
A channel for sending messages to a Component
.
Implementations§
Source§impl<C: 'static + Component> Scope<C>
impl<C: 'static + Component> Scope<C>
Sourcepub fn try_send(
&self,
message: C::Message,
) -> Result<(), TrySendError<C::Message>>
pub fn try_send( &self, message: C::Message, ) -> Result<(), TrySendError<C::Message>>
Attempt to send a message to the component this Scope
belongs to.
This should always succeed if the component is running.
If you receive an error, this generally means the component has unmounted and the scope has become invalid.
If the message is sent successfully, it will show up at your
component’s Component::update()
method presently.
Never call this from inside a signal handler. It’s important that you follow the usual pattern of returning messages from signal handler closures, or you risk unexpected side effects and potential infinite loops.
Trait Implementations§
Source§impl<C: Component> PartialEq for Scope<C>
impl<C: Component> PartialEq for Scope<C>
impl<C: Component> Eq for Scope<C>
Auto Trait Implementations§
impl<C> Freeze for Scope<C>
impl<C> !RefUnwindSafe for Scope<C>
impl<C> Send for Scope<C>
impl<C> Sync for Scope<C>
impl<C> Unpin for Scope<C>
impl<C> !UnwindSafe for Scope<C>
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