GraphNode

Struct GraphNode 

Source
pub struct GraphNode {
Show 17 fields pub chunk_id: String, pub content_hash: String, pub primary_alias: Option<String>, pub aliases: Vec<String>, pub symbols_defined: Vec<String>, pub symbols_referenced: Vec<String>, pub language: String, pub granularity: String, pub byte_size: usize, pub token_estimate: usize, pub source_file: Option<String>, pub source_lines: Option<(usize, usize)>, pub outgoing_edges: Vec<(EdgeType, String)>, pub incoming_edges: Vec<(EdgeType, String)>, pub metadata: HashMap<String, String>, pub created_at: String, pub updated_at: String,
}
Expand description

A node in the dependency graph

Fields§

§chunk_id: String

The chunk ID (e.g., “chunk:sha256:abc123…”)

§content_hash: String

Content hash of the chunk

§primary_alias: Option<String>

Primary alias for this chunk

§aliases: Vec<String>

All aliases pointing to this chunk

§symbols_defined: Vec<String>

Symbols this chunk defines/exports

§symbols_referenced: Vec<String>

Symbols this chunk references/imports

§language: String

Language of the chunk

§granularity: String

Granularity (function, type, module, etc.)

§byte_size: usize

Byte size of content

§token_estimate: usize

Estimated token count (for LLM budgeting)

§source_file: Option<String>

Source file location

§source_lines: Option<(usize, usize)>

Line range in source file

§outgoing_edges: Vec<(EdgeType, String)>

Outgoing edges (this chunk depends on)

§incoming_edges: Vec<(EdgeType, String)>

Incoming edges (chunks that depend on this)

§metadata: HashMap<String, String>

Additional metadata

§created_at: String

When this node was created

§updated_at: String

When this node was last updated

Implementations§

Source§

impl GraphNode

Source

pub fn new(chunk_id: impl Into<String>, content_hash: impl Into<String>) -> Self

Create a new graph node

Source

pub fn with_alias(self, alias: impl Into<String>) -> Self

Set the primary alias

Source

pub fn with_language(self, language: impl Into<String>) -> Self

Set the language

Source

pub fn with_granularity(self, granularity: impl Into<String>) -> Self

Set the granularity

Source

pub fn with_size(self, byte_size: usize) -> Self

Set the byte size

Source

pub fn with_source( self, file: impl Into<String>, start: usize, end: usize, ) -> Self

Set source location

Source

pub fn with_defines(self, symbols: Vec<String>) -> Self

Add symbols this chunk defines

Source

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

Add symbols this chunk references

Source

pub fn add_dependency(&mut self, edge_type: EdgeType, target_id: String)

Add an outgoing edge (dependency)

Source

pub fn add_dependent(&mut self, edge_type: EdgeType, source_id: String)

Add an incoming edge (dependent)

Source

pub fn dependencies(&self) -> impl Iterator<Item = &String>

Get all chunks this depends on

Source

pub fn dependents(&self) -> impl Iterator<Item = &String>

Get all chunks that depend on this

Source

pub fn dependencies_of_type(&self, edge_type: EdgeType) -> Vec<&String>

Get dependencies filtered by edge type

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, Error>

Serialize for storage

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Deserialize from storage

Trait Implementations§

Source§

impl Clone for GraphNode

Source§

fn clone(&self) -> GraphNode

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 GraphNode

Source§

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

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

impl Default for GraphNode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GraphNode

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 Serialize for GraphNode

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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