pub struct Emitter<Event, Payload>(/* private fields */);
Expand description
An emitter which can only send the event used to create it
let mut manager: EventManager<StringEvent, i32> = EventManager::new();
let mut subscriber = manager.subscribe("Event".into());
let mut emitter = manager.emitter("Event".into());
drop(manager);
emitter.emit(57);
assert_eq!(block_on(subscriber.next()), Some(57));
drop(emitter);
assert_eq!(block_on(subscriber.next()), None);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<Event, Payload> Freeze for Emitter<Event, Payload>
impl<Event, Payload> RefUnwindSafe for Emitter<Event, Payload>where
Event: RefUnwindSafe,
impl<Event, Payload> Send for Emitter<Event, Payload>
impl<Event, Payload> Sync for Emitter<Event, Payload>
impl<Event, Payload> Unpin for Emitter<Event, Payload>where
Event: Unpin,
impl<Event, Payload> UnwindSafe for Emitter<Event, Payload>where
Event: UnwindSafe,
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