grapha_core/resolve.rs
1use serde::{Deserialize, Serialize};
2
3/// A structured import declaration extracted from source code.
4#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5pub struct Import {
6 /// The raw import path as written in source (e.g., "std::collections::HashMap")
7 pub path: String,
8 /// Specific symbols imported (empty = wildcard/module import)
9 pub symbols: Vec<String>,
10 /// The kind of import
11 pub kind: ImportKind,
12}
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
15#[serde(rename_all = "snake_case")]
16pub enum ImportKind {
17 /// Named import: `use std::collections::HashMap;`
18 Named,
19 /// Wildcard/glob import: `use std::collections::*;`
20 Wildcard,
21 /// Module import: `import Foundation` (Swift)
22 Module,
23 /// Relative import: `use super::foo;`, `use crate::bar;`
24 Relative,
25}