Skip to main content

CodeNode

Struct CodeNode 

Source
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: String

Unique identifier, derived from file path + qualified name + kind.

§name: String

The simple name (e.g., “validate_user”).

§qualified_name: String

Fully qualified name including parent scope (e.g., “UserService.validate_user”).

§kind: NodeKind

What kind of entity this is.

§file: String

Path to the source file, relative to project root.

§line_start: u32

Starting line (1-indexed, like editors show).

§line_end: u32

Ending line (inclusive).

§column: u32

Column of the name identifier.

§signature: Option<String>

Function/method signature if applicable.

§visibility: Visibility

Visibility modifier.

§is_async: bool

Whether this is async.

§is_static: bool

Whether this is static/class-level.

§is_exported: bool

Whether this is exported (TS/ES modules).

§docstring: Option<String>

Docstring or leading comment.

§byte_start: u32

Byte 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

Source

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.

Source

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.

Source

pub fn with_lines(self, start: u32, end: u32) -> Self

Builder pattern: set line range.

Source

pub fn with_bytes(self, start: u32, end: u32) -> Self

Builder pattern: set byte range.

Source

pub fn with_column(self, column: u32) -> Self

Builder pattern: set column.

Source

pub fn with_signature(self, sig: impl Into<String>) -> Self

Builder pattern: set signature.

Source

pub fn with_visibility(self, vis: Visibility) -> Self

Builder pattern: set visibility.

Source

pub fn as_async(self) -> Self

Builder pattern: mark as async.

Source

pub fn as_static(self) -> Self

Builder pattern: mark as static.

Source

pub fn as_exported(self) -> Self

Builder pattern: mark as exported.

Source

pub fn with_references(self, refs: Vec<String>) -> Self

Builder pattern: add references.

Trait Implementations§

Source§

impl Clone for CodeNode

Source§

fn clone(&self) -> CodeNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CodeNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CodeNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for CodeNode

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CodeNode

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CodeNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CodeNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,