pub struct GraphBuilder { /* private fields */ }Expand description
Fluent builder for constructing a CodeGraph.
§Examples
use agentic_codebase::graph::GraphBuilder;
use agentic_codebase::types::*;
use std::path::PathBuf;
let graph = GraphBuilder::new(256)
.add_unit(CodeUnit::new(
CodeUnitType::Module,
Language::Python,
"mymodule".into(),
"mymodule".into(),
PathBuf::from("mymodule.py"),
Span::new(1, 0, 100, 0),
))
.add_unit(CodeUnit::new(
CodeUnitType::Function,
Language::Python,
"my_func".into(),
"mymodule.my_func".into(),
PathBuf::from("mymodule.py"),
Span::new(10, 0, 20, 0),
))
.add_edge(Edge::new(0, 1, EdgeType::Contains))
.build()
.unwrap();Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn new(dimension: usize) -> Self
pub fn new(dimension: usize) -> Self
Create a new builder with the given feature vector dimension.
Sourcepub fn with_default_dimension() -> Self
pub fn with_default_dimension() -> Self
Create with default dimension (256).
Sourcepub fn build(self) -> AcbResult<CodeGraph>
pub fn build(self) -> AcbResult<CodeGraph>
Consume the builder and produce a CodeGraph.
All pending edges are validated and added. Returns an error if any edge is invalid.
Sourcepub fn build_lenient(self) -> CodeGraph
pub fn build_lenient(self) -> CodeGraph
Build, ignoring invalid edges (logs warnings).
Auto Trait Implementations§
impl Freeze for GraphBuilder
impl RefUnwindSafe for GraphBuilder
impl Send for GraphBuilder
impl Sync for GraphBuilder
impl Unpin for GraphBuilder
impl UnsafeUnpin for GraphBuilder
impl UnwindSafe for GraphBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more