ratatui_toolkit/widgets/code_diff/widget/constructors/with_file_path.rs
1use crate::widgets::code_diff::code_diff::CodeDiff;
2
3impl CodeDiff {
4 /// Sets the file path for this diff.
5 ///
6 /// # Arguments
7 ///
8 /// * `path` - The file path to display in the header
9 ///
10 /// # Returns
11 ///
12 /// Self for method chaining
13 ///
14 /// # Example
15 ///
16 /// ```rust
17 /// use ratatui_toolkit::code_diff::CodeDiff;
18 ///
19 /// let diff = CodeDiff::new().with_file_path("src/main.rs");
20 /// ```
21 pub fn with_file_path(mut self, path: impl Into<String>) -> Self {
22 self.file_path = Some(path.into());
23 self
24 }
25}