ratatui_toolkit/diff_file_tree/constructors/with_focus.rs
1//! Builder method for setting focus state.
2
3use crate::diff_file_tree::DiffFileTree;
4
5impl DiffFileTree {
6 /// Sets the focus state and returns self for chaining.
7 ///
8 /// This is a builder method that can be chained after constructors.
9 ///
10 /// # Arguments
11 ///
12 /// * `focused` - Whether the tree should have focus
13 ///
14 /// # Example
15 ///
16 /// ```rust
17 /// use ratatui_toolkit::diff_file_tree::{DiffFileTree, FileStatus};
18 ///
19 /// let tree = DiffFileTree::from_paths(&[("src/lib.rs", FileStatus::Modified)])
20 /// .with_focus(true);
21 /// ```
22 #[must_use]
23 pub fn with_focus(mut self, focused: bool) -> Self {
24 self.focused = focused;
25 self
26 }
27}