pub struct EmbeddingUnit {Show 21 fields
pub id: String,
pub file: String,
pub name: String,
pub kind: UnitKind,
pub code: String,
pub signature: String,
pub docstring: Option<String>,
pub start_line: usize,
pub end_line: usize,
pub token_count: usize,
pub semantic_tags: Vec<String>,
pub parent: Option<String>,
pub language: String,
pub calls: Vec<String>,
pub called_by: Vec<String>,
pub cfg_summary: String,
pub dfg_summary: String,
pub dependencies: String,
pub complexity: CodeComplexity,
pub chunk_index: usize,
pub chunk_total: usize,
}Expand description
A code unit for semantic embedding.
Contains information from all 5 brrr analysis layers plus semantic enrichment. This is the primary unit of indexing and retrieval in semantic search.
Fields§
§id: StringUnique identifier (typically file::qualified_name or file::name#chunkN)
file: StringSource file path (relative to project root)
name: StringSimple name (function/class/method name)
kind: UnitKindKind of code unit
code: StringFull code content (may be truncated for large units)
signature: StringFunction/method signature or class declaration
docstring: Option<String>Docstring or documentation comment
start_line: usizeStarting line number (1-indexed)
end_line: usizeEnding line number (1-indexed)
token_count: usizeToken count for this unit’s code
Semantic tags detected from code patterns
parent: Option<String>Parent unit name (for chunks and methods)
language: StringL1: Programming language
calls: Vec<String>L2: Functions this unit calls
called_by: Vec<String>L2: Functions that call this unit
cfg_summary: StringL3: CFG summary (complexity, block count)
dfg_summary: StringL4: DFG summary (variable count, def-use chains)
dependencies: StringL5: Dependencies (imported modules)
complexity: CodeComplexityCode complexity metrics
chunk_index: usizeChunk index (0-indexed, for chunked units)
chunk_total: usizeTotal number of chunks (1 for non-chunked units)
Implementations§
Source§impl EmbeddingUnit
impl EmbeddingUnit
Sourcepub fn new(
file: impl Into<String>,
name: impl Into<String>,
kind: UnitKind,
code: impl Into<String>,
start_line: usize,
language: impl Into<String>,
) -> Self
pub fn new( file: impl Into<String>, name: impl Into<String>, kind: UnitKind, code: impl Into<String>, start_line: usize, language: impl Into<String>, ) -> Self
Create a new embedding unit with minimal required fields.
Sourcepub fn needs_chunking(&self) -> bool
pub fn needs_chunking(&self) -> bool
Check if this unit needs to be split into chunks based on token count.
Sourcepub fn qualified_name(&self) -> String
pub fn qualified_name(&self) -> String
Get the qualified name (file::name or file::parent.name for methods).
Trait Implementations§
Source§impl Clone for EmbeddingUnit
impl Clone for EmbeddingUnit
Source§fn clone(&self) -> EmbeddingUnit
fn clone(&self) -> EmbeddingUnit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmbeddingUnit
impl Debug for EmbeddingUnit
Source§impl<'de> Deserialize<'de> for EmbeddingUnit
impl<'de> Deserialize<'de> for EmbeddingUnit
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 EmbeddingUnit
impl RefUnwindSafe for EmbeddingUnit
impl Send for EmbeddingUnit
impl Sync for EmbeddingUnit
impl Unpin for EmbeddingUnit
impl UnwindSafe for EmbeddingUnit
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request