2020-01-10 01:28:45 +01:00
|
|
|
//! Build window-based GUI applications.
|
2021-09-01 19:21:49 +07:00
|
|
|
mod action;
|
2020-01-10 01:28:45 +01:00
|
|
|
mod event;
|
2022-08-18 14:39:15 +02:00
|
|
|
mod mode;
|
2022-12-10 01:53:00 +13:00
|
|
|
mod user_attention;
|
2020-01-10 01:28:45 +01:00
|
|
|
|
2021-09-01 19:21:49 +07:00
|
|
|
pub use action::Action;
|
2020-01-10 01:28:45 +01:00
|
|
|
pub use event::Event;
|
2022-08-18 14:39:15 +02:00
|
|
|
pub use mode::Mode;
|
2022-12-10 01:53:00 +13:00
|
|
|
pub use user_attention::UserAttention;
|
2023-01-12 04:35:41 +01:00
|
|
|
|
|
|
|
|
use crate::subscription::{self, Subscription};
|
|
|
|
|
|
|
|
|
|
use std::time::Instant;
|
|
|
|
|
|
|
|
|
|
/// Subscribes to the frames of the window of the running application.
|
|
|
|
|
///
|
|
|
|
|
/// The resulting [`Subscription`] will produce items at a rate equal to the
|
|
|
|
|
/// framerate of the monitor of said window.
|
|
|
|
|
pub fn frames() -> Subscription<Instant> {
|
|
|
|
|
subscription::raw_events(|event, _status| match event {
|
|
|
|
|
crate::Event::Window(Event::RedrawRequested(at)) => Some(at),
|
|
|
|
|
_ => None,
|
|
|
|
|
})
|
|
|
|
|
}
|