pub struct EventMut<'a, E>where
E: Event,{ /* private fields */ }
Expand description
Implementations§
Source§impl<'a, E> EventMut<'a, E>where
E: Event,
impl<'a, E> EventMut<'a, E>where
E: Event,
Sourcepub fn take(this: EventMut<'a, E>) -> E
pub fn take(this: EventMut<'a, E>) -> E
Takes ownership of the event. Any handlers expected to run after the current handler will not run.
§Examples
world.add_handler(|r: ReceiverMut<E>| {
EventMut::take(r.event); // Took ownership of event.
});
world.add_handler(|_: Receiver<E>| panic!("boom"));
world.send(E);
// ^ No panic occurs because the first handler took
// ownership of the event before the second could run.
Trait Implementations§
impl<'a, E> Send for EventMut<'a, E>
impl<'a, E> Sync for EventMut<'a, E>
Auto Trait Implementations§
impl<'a, E> Freeze for EventMut<'a, E>
impl<'a, E> RefUnwindSafe for EventMut<'a, E>
impl<'a, E> Unpin for EventMut<'a, E>
impl<'a, E> !UnwindSafe for EventMut<'a, E>
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