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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Helper utilities for common TEA patterns
//!
//! This module provides utilities for handling common UI patterns
//! that are tricky to implement correctly in a pure TEA architecture.
//!
//! # Debouncing
//!
//! Use [`Debouncer`] when you want to delay an action until input stops.
//! Perfect for search-as-you-type, form validation, auto-save.
//!
//! ```ignore
//! use egui_cha::helpers::Debouncer;
//!
//! struct Model {
//! search: String,
//! debouncer: Debouncer,
//! }
//!
//! fn update(model: &mut Model, msg: Msg) -> Cmd<Msg> {
//! match msg {
//! Msg::Input(s) => {
//! model.search = s;
//! model.debouncer.trigger(Duration::from_millis(300), Msg::Search)
//! }
//! Msg::Search => {
//! if model.debouncer.should_fire() {
//! // Do search
//! }
//! Cmd::none()
//! }
//! }
//! }
//! ```
//!
//! # Throttling
//!
//! Use [`Throttler`] when you want to limit action frequency.
//! Perfect for scroll handlers, resize events, API rate limiting.
//!
//! ```ignore
//! use egui_cha::helpers::Throttler;
//!
//! struct Model {
//! throttler: Throttler,
//! }
//!
//! fn update(model: &mut Model, msg: Msg) -> Cmd<Msg> {
//! match msg {
//! Msg::Scroll(pos) => {
//! model.throttler.run(Duration::from_millis(100), || {
//! Cmd::msg(Msg::UpdateView)
//! })
//! }
//! }
//! }
//! ```
//!
//! # Comparison
//!
//! | Pattern | Behavior | Use Case |
//! |---------|----------|----------|
//! | Debounce | Waits until input stops | Search input, form validation |
//! | Throttle | Limits frequency | Scroll, resize, API calls |
pub use ;
pub use ;
pub use ;