Skip to main content

cha_core/
source.rs

1use std::path::PathBuf;
2
3/// Raw source file content.
4#[derive(Debug, Clone)]
5pub struct SourceFile {
6    pub path: PathBuf,
7    pub content: String,
8}
9
10impl SourceFile {
11    pub fn new(path: PathBuf, content: String) -> Self {
12        Self { path, content }
13    }
14
15    pub fn line_count(&self) -> usize {
16        self.content.lines().count()
17    }
18}