sql_cli/widget_traits.rs
1/// Trait for widgets that can provide debug information
2///
3/// All widgets in the TUI should implement this trait to provide
4/// consistent debug output for the F5 debug view.
5pub trait DebugInfoProvider {
6 /// Generate a formatted string containing debug information about the widget's state
7 ///
8 /// The output should be human-readable and include:
9 /// - Widget name/type as a header
10 /// - Current state (active/inactive, mode, etc.)
11 /// - Any cached or saved data
12 /// - Configuration or settings
13 /// - Any error states or warnings
14 fn debug_info(&self) -> String;
15
16 /// Optional: Get a short one-line summary of the widget state
17 /// Useful for compact debug views
18 fn debug_summary(&self) -> String {
19 "No summary available".to_string()
20 }
21}
22
23/// Extension trait for collecting debug info from multiple widgets
24pub trait DebugInfoCollector {
25 /// Collect debug info from all widgets
26 fn collect_widget_debug_info(&self) -> String;
27}