19 lines
708 B
Rust
19 lines
708 B
Rust
//! Listen to external events in your application.
|
|
use crate::Hasher;
|
|
|
|
/// A request to listen to external events.
|
|
///
|
|
/// Besides performing async actions on demand with [`Command`], most
|
|
/// applications also need to listen to external events passively.
|
|
///
|
|
/// A [`Subscription`] is normally provided to some runtime, like a [`Command`],
|
|
/// and it will generate events as long as the user keeps requesting it.
|
|
///
|
|
/// For instance, you can use a [`Subscription`] to listen to a WebSocket
|
|
/// connection, keyboard presses, mouse events, time ticks, etc.
|
|
///
|
|
/// [`Command`]: crate::Command
|
|
pub type Subscription<T> = iced_futures::Subscription<Hasher, (), T>;
|
|
|
|
pub use iced_futures::subscription::Recipe;
|