summaryrefslogtreecommitdiffstats
path: root/native/src/window.rs
blob: 4bccc471bfc421a7a24916b36b0999b9db41b11c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Build window-based GUI applications.
mod action;
mod event;
mod mode;
mod user_attention;

pub use action::Action;
pub use event::Event;
pub use mode::Mode;
pub use user_attention::UserAttention;

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,
    })
}