pub struct CodeNode {Show 17 fields
pub id: String,
pub name: String,
pub qualified_name: String,
pub kind: NodeKind,
pub file: String,
pub line_start: u32,
pub line_end: u32,
pub column: u32,
pub signature: Option<String>,
pub visibility: Visibility,
pub is_async: bool,
pub is_static: bool,
pub is_exported: bool,
pub docstring: Option<String>,
pub byte_start: u32,
pub byte_end: u32,
pub references: Vec<String>,
}Expand description
A code entity extracted from source.
This is the core data type that flows through Arbor. It’s designed to be language-agnostic while still capturing the structure we need.
Fields§
§id: StringUnique identifier, derived from file path + qualified name + kind.
name: StringThe simple name (e.g., “validate_user”).
qualified_name: StringFully qualified name including parent scope (e.g., “UserService.validate_user”).
kind: NodeKindWhat kind of entity this is.
file: StringPath to the source file, relative to project root.
line_start: u32Starting line (1-indexed, like editors show).
line_end: u32Ending line (inclusive).
column: u32Column of the name identifier.
signature: Option<String>Function/method signature if applicable.
visibility: VisibilityVisibility modifier.
is_async: boolWhether this is async.
is_static: boolWhether this is static/class-level.
is_exported: boolWhether this is exported (TS/ES modules).
docstring: Option<String>Docstring or leading comment.
byte_start: u32Byte offset range in source for incremental updates.
byte_end: u32§references: Vec<String>Entities this node references (call targets, type refs, etc). These are names, not IDs - resolution happens in the graph crate.
Implementations§
Source§impl CodeNode
impl CodeNode
Sourcepub fn compute_id(file: &str, qualified_name: &str, kind: NodeKind) -> String
pub fn compute_id(file: &str, qualified_name: &str, kind: NodeKind) -> String
Creates a deterministic ID for this node.
The ID is a hash of (file, qualified_name, kind) so the same entity always gets the same ID across parses.
Sourcepub fn new(
name: impl Into<String>,
qualified_name: impl Into<String>,
kind: NodeKind,
file: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, qualified_name: impl Into<String>, kind: NodeKind, file: impl Into<String>, ) -> Self
Creates a new node and automatically computes its ID.
Sourcepub fn with_lines(self, start: u32, end: u32) -> Self
pub fn with_lines(self, start: u32, end: u32) -> Self
Builder pattern: set line range.
Sourcepub fn with_bytes(self, start: u32, end: u32) -> Self
pub fn with_bytes(self, start: u32, end: u32) -> Self
Builder pattern: set byte range.
Sourcepub fn with_column(self, column: u32) -> Self
pub fn with_column(self, column: u32) -> Self
Builder pattern: set column.
Sourcepub fn with_signature(self, sig: impl Into<String>) -> Self
pub fn with_signature(self, sig: impl Into<String>) -> Self
Builder pattern: set signature.
Sourcepub fn with_visibility(self, vis: Visibility) -> Self
pub fn with_visibility(self, vis: Visibility) -> Self
Builder pattern: set visibility.
Sourcepub fn as_exported(self) -> Self
pub fn as_exported(self) -> Self
Builder pattern: mark as exported.
Sourcepub fn with_references(self, refs: Vec<String>) -> Self
pub fn with_references(self, refs: Vec<String>) -> Self
Builder pattern: add references.