SourceCodeGraphBuilder

Struct SourceCodeGraphBuilder 

Source
pub struct SourceCodeGraphBuilder { /* private fields */ }
Expand description

Builder for constructing a SourceCodeGraph from project data.

Implementations§

Source§

impl SourceCodeGraphBuilder

Source

pub fn new() -> Self

Create a new builder.

Source

pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Set metadata for the graph.

Source

pub fn add_directory(&mut self, path: &Path) -> NodeId

Add a directory node.

Source

pub fn add_file(&mut self, path: &Path, relative_path: &str) -> NodeId

Add a file node with optional language detection.

Source

pub fn add_hierarchy_edge(&mut self, parent_path: &Path, child_path: &Path)

Add a hierarchy edge (parent contains child).

Source

pub fn add_edge(&mut self, from: NodeId, to: NodeId, kind: ReferenceKind)

Add an edge between two nodes.

Source

pub fn get_node_id(&self, path: &Path) -> Option<NodeId>

Get NodeId for a path if it exists.

Source

pub fn find_node_by_path_suffix(&self, route: &Path) -> Option<NodeId>

Find a node by matching path suffix (for reference resolution).

Source

pub fn node_count(&self) -> usize

Get the current node count.

Source

pub fn edge_count(&self) -> usize

Get the current edge count.

Source

pub fn build(self) -> SourceCodeGraph

Build the final SourceCodeGraph.

Trait Implementations§

Source§

impl Debug for SourceCodeGraphBuilder

Source§

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

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

impl Default for SourceCodeGraphBuilder

Source§

fn default() -> SourceCodeGraphBuilder

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

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.