pub struct Event<T> { /* private fields */ }Expand description
A stream of discrete occurrences
Event<T> allows you to react to discrete happenings like clicks,
keypresses, or timer ticks. Events can be mapped, filtered, and
merged with other events.
§Example
use cliffy_core::{event, Event};
let clicks = event::<()>();
clicks.subscribe(|_| {
println!("Clicked!");
});
clicks.emit(());Implementations§
Source§impl<T: Clone + 'static> Event<T>
impl<T: Clone + 'static> Event<T>
Sourcepub fn subscribe<F>(&self, callback: F) -> EventSubscription
pub fn subscribe<F>(&self, callback: F) -> EventSubscription
Subscribe to this event stream
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Event<T>
impl<T> !RefUnwindSafe for Event<T>
impl<T> !Send for Event<T>
impl<T> !Sync for Event<T>
impl<T> Unpin for Event<T>
impl<T> UnsafeUnpin for Event<T>
impl<T> !UnwindSafe for Event<T>
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