codegraph_parser_api/entities/
module.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5pub struct ModuleEntity {
6 pub name: String,
8
9 pub path: String,
11
12 pub language: String,
14
15 pub line_count: usize,
17
18 pub doc_comment: Option<String>,
20
21 pub attributes: Vec<String>,
23}
24
25impl ModuleEntity {
26 pub fn new(
27 name: impl Into<String>,
28 path: impl Into<String>,
29 language: impl Into<String>,
30 ) -> Self {
31 Self {
32 name: name.into(),
33 path: path.into(),
34 language: language.into(),
35 line_count: 0,
36 doc_comment: None,
37 attributes: Vec::new(),
38 }
39 }
40
41 pub fn with_line_count(mut self, count: usize) -> Self {
42 self.line_count = count;
43 self
44 }
45
46 pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
47 self.doc_comment = Some(doc.into());
48 self
49 }
50
51 pub fn with_attributes(mut self, attrs: Vec<String>) -> Self {
52 self.attributes = attrs;
53 self
54 }
55}