1use crate::protocol::display::Line;
3use vvv_core::RelPath;
4
5#[derive(Debug, Clone)]
7pub struct Row {
8 pub line: Line,
9 pub source: Option<Source>,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct Source {
16 pub path: RelPath,
17 pub line: u32,
18}
19
20impl Row {
21 pub fn new(line: Line) -> Self {
23 Self { line, source: None }
24 }
25
26 pub fn at(line: Line, path: RelPath, at: u32) -> Self {
28 Self {
29 line,
30 source: Some(Source { path, line: at }),
31 }
32 }
33
34 pub fn wrap(lines: Vec<Line>) -> Vec<Self> {
36 lines.into_iter().map(Self::new).collect()
37 }
38}