pub struct CodeChunk {Show 16 fields
pub id: String,
pub content: String,
pub chunk_type: ChunkType,
pub start_line: usize,
pub end_line: usize,
pub file_path: String,
pub relative_path: String,
pub folder_structure: Vec<String>,
pub name: Option<String>,
pub parent_name: Option<String>,
pub language: String,
pub docstring: Option<String>,
pub decorators: Vec<String>,
pub imports: Vec<String>,
pub tags: Vec<String>,
pub complexity_score: u32,
}Expand description
A semantic chunk of code extracted from a source file
Fields§
§id: StringUnique identifier for this chunk
content: StringThe actual source code content
chunk_type: ChunkTypeType of code construct
start_line: usizeStarting line number (1-based)
end_line: usizeEnding line number (1-based)
file_path: StringAbsolute file path
relative_path: StringRelative file path from project root
folder_structure: Vec<String>Folder components of the path (e.g., [“src”, “utils”, “auth”])
name: Option<String>Name of the construct (function/class/method name)
parent_name: Option<String>Parent construct name (e.g., class name for methods)
language: StringProgramming language
docstring: Option<String>Docstring/documentation comment
decorators: Vec<String>Decorator/attribute annotations
imports: Vec<String>Import statements within this chunk
Semantic tags for categorization
complexity_score: u32Complexity indicator (rough metric)
Implementations§
Source§impl CodeChunk
impl CodeChunk
Sourcepub fn generate_id(
file_path: &str,
start_line: usize,
end_line: usize,
name: Option<&str>,
) -> String
pub fn generate_id( file_path: &str, start_line: usize, end_line: usize, name: Option<&str>, ) -> String
Generate a unique chunk ID from file path, line range, and name
Sourcepub fn extract_folder_structure(relative_path: &str) -> Vec<String>
pub fn extract_folder_structure(relative_path: &str) -> Vec<String>
Extract folder structure from a relative path
Sourcepub fn compute_complexity(content: &str) -> u32
pub fn compute_complexity(content: &str) -> u32
Compute a rough complexity score based on content
Extract semantic tags from content
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CodeChunk
impl<'de> Deserialize<'de> for CodeChunk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CodeChunk
impl RefUnwindSafe for CodeChunk
impl Send for CodeChunk
impl Sync for CodeChunk
impl Unpin for CodeChunk
impl UnsafeUnpin for CodeChunk
impl UnwindSafe for CodeChunk
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more