ratatui_toolkit/widgets/markdown_widget/state/git_stats_state/methods/get.rs
1//! Git stats getter method for GitStatsState.
2
3use crate::widgets::markdown_widget::foundation::types::GitStats;
4use crate::widgets::markdown_widget::state::git_stats_state::GitStatsState;
5
6impl GitStatsState {
7 /// Get the cached git stats.
8 ///
9 /// # Returns
10 ///
11 /// The cached `GitStats` if available and git stats are enabled.
12 pub fn get(&self) -> Option<GitStats> {
13 if self.show {
14 self.cache
15 } else {
16 None
17 }
18 }
19
20 /// Get the cached git stats (alias for `get()`).
21 ///
22 /// # Returns
23 ///
24 /// The cached `GitStats` if available and git stats are enabled.
25 pub fn git_stats(&self) -> Option<GitStats> {
26 self.get()
27 }
28
29 /// Check if git stats display is enabled.
30 pub fn is_enabled(&self) -> bool {
31 self.show
32 }
33}