Skip to main content

ferroui_base/threading/
dispatcher_options.rs

1use std::time::Duration;
2
3/// Options for the dispatcher, registered with the service locator.
4#[derive(Clone, Copy, Debug, PartialEq)]
5pub struct DispatcherOptions {
6    /// Gets or sets a timeout after which the dispatcher will start
7    /// prioritizing input events over rendering. The default value is one
8    /// second.
9    ///
10    /// If no input events are processed within this time, the dispatcher
11    /// will start prioritizing input events over rendering to prevent the
12    /// application from becoming unresponsive. This may need to be lowered on
13    /// resource-constrained platforms where input events are processed on
14    /// the same thread as rendering.
15    pub input_starvation_timeout: Duration,
16}
17
18impl Default for DispatcherOptions {
19    fn default() -> Self {
20        Self { input_starvation_timeout: Duration::from_secs(1) }
21    }
22}