pub struct CodeUnitBuilder { /* private fields */ }Expand description
Builder for constructing CodeUnit instances with optional fields.
§Examples
use agentic_codebase::types::*;
use std::path::PathBuf;
let unit = CodeUnitBuilder::new(
CodeUnitType::Function,
Language::Python,
"my_func",
"mymodule.my_func",
PathBuf::from("src/mymodule.py"),
Span::new(10, 0, 20, 0),
)
.signature("(x: int) -> bool")
.doc("Checks if x is valid")
.visibility(Visibility::Public)
.complexity(3)
.build();Implementations§
Source§impl CodeUnitBuilder
impl CodeUnitBuilder
Sourcepub fn new(
unit_type: CodeUnitType,
language: Language,
name: impl Into<String>,
qualified_name: impl Into<String>,
file_path: impl Into<PathBuf>,
span: Span,
) -> Self
pub fn new( unit_type: CodeUnitType, language: Language, name: impl Into<String>, qualified_name: impl Into<String>, file_path: impl Into<PathBuf>, span: Span, ) -> Self
Create a new builder with required fields.
Sourcepub fn visibility(self, vis: Visibility) -> Self
pub fn visibility(self, vis: Visibility) -> Self
Set the visibility level.
Sourcepub fn complexity(self, c: u32) -> Self
pub fn complexity(self, c: u32) -> Self
Set the cyclomatic complexity.
Sourcepub fn feature_vec(self, vec: Vec<f32>) -> Self
pub fn feature_vec(self, vec: Vec<f32>) -> Self
Set the feature vector.
Sourcepub fn content_hash(self, hash: [u8; 32]) -> Self
pub fn content_hash(self, hash: [u8; 32]) -> Self
Set the content hash.
Sourcepub fn timestamps(self, created: u64, modified: u64) -> Self
pub fn timestamps(self, created: u64, modified: u64) -> Self
Set timestamps.
Auto Trait Implementations§
impl Freeze for CodeUnitBuilder
impl RefUnwindSafe for CodeUnitBuilder
impl Send for CodeUnitBuilder
impl Sync for CodeUnitBuilder
impl Unpin for CodeUnitBuilder
impl UnsafeUnpin for CodeUnitBuilder
impl UnwindSafe for CodeUnitBuilder
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