ratatui_toolkit/widgets/code_diff/foundation/diff_line/methods/is_context.rs
1use crate::widgets::code_diff::diff_line::DiffLine;
2use crate::widgets::code_diff::enums::DiffLineKind;
3
4impl DiffLine {
5 /// Returns true if this is a context (unchanged) line.
6 ///
7 /// # Returns
8 ///
9 /// `true` if the line kind is `Context`, `false` otherwise
10 ///
11 /// # Example
12 ///
13 /// ```rust
14 /// use ratatui_toolkit::code_diff::DiffLine;
15 ///
16 /// let line = DiffLine::context("unchanged", 1, 1);
17 /// assert!(line.is_context());
18 /// ```
19 pub fn is_context(&self) -> bool {
20 matches!(self.kind, DiffLineKind::Context)
21 }
22}