codegraph_parser_api/relationships/
calls.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub struct CallRelation {
6 pub caller: String,
8
9 pub callee: String,
11
12 pub call_site_line: usize,
14
15 pub is_direct: bool,
17}
18
19impl CallRelation {
20 pub fn new(caller: impl Into<String>, callee: impl Into<String>, line: usize) -> Self {
21 Self {
22 caller: caller.into(),
23 callee: callee.into(),
24 call_site_line: line,
25 is_direct: true,
26 }
27 }
28
29 pub fn indirect(mut self) -> Self {
30 self.is_direct = false;
31 self
32 }
33}