codegraph_parser_api/relationships/
inheritance.rs

1use serde::{Deserialize, Serialize};
2
3/// Represents class inheritance
4#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub struct InheritanceRelation {
6    /// Child class
7    pub child: String,
8
9    /// Parent class
10    pub parent: String,
11
12    /// Inheritance order (for multiple inheritance)
13    pub order: usize,
14}
15
16impl InheritanceRelation {
17    pub fn new(child: impl Into<String>, parent: impl Into<String>) -> Self {
18        Self {
19            child: child.into(),
20            parent: parent.into(),
21            order: 0,
22        }
23    }
24
25    pub fn with_order(mut self, order: usize) -> Self {
26        self.order = order;
27        self
28    }
29}