pub struct CodeIndex { /* private fields */ }Expand description
A searchable index over a set of function blobs.
Implementations§
Source§impl CodeIndex
impl CodeIndex
Sourcepub fn index_function(
&mut self,
hash: [u8; 32],
name: String,
arity: u16,
instruction_count: usize,
dependencies: Vec<[u8; 32]>,
type_schemas: Vec<String>,
is_async: bool,
is_closure: bool,
captures_count: u16,
)
pub fn index_function( &mut self, hash: [u8; 32], name: String, arity: u16, instruction_count: usize, dependencies: Vec<[u8; 32]>, type_schemas: Vec<String>, is_async: bool, is_closure: bool, captures_count: u16, )
Add a function to the index.
Sourcepub fn search(&self, query: &FunctionQuery) -> SearchResult
pub fn search(&self, query: &FunctionQuery) -> SearchResult
Execute a query against the index, returning all functions that match every specified criterion.
Sourcepub fn find_callers(&self, function_hash: [u8; 32]) -> Vec<IndexedFunction>
pub fn find_callers(&self, function_hash: [u8; 32]) -> Vec<IndexedFunction>
Find functions that call the given function hash (i.e. have it as a dependency).
Sourcepub fn find_callees(&self, function_hash: [u8; 32]) -> Vec<IndexedFunction>
pub fn find_callees(&self, function_hash: [u8; 32]) -> Vec<IndexedFunction>
Find functions called by the given function hash (its direct dependencies).
Sourcepub fn dependency_depth(&self, function_hash: [u8; 32]) -> Option<usize>
pub fn dependency_depth(&self, function_hash: [u8; 32]) -> Option<usize>
Compute the transitive dependency depth for a function.
Returns None if the function is not in the index.
A function with no dependencies has depth 0.
A function that calls only leaf functions has depth 1, etc.
Cycles are detected and treated as already-visited (depth 0 contribution).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeIndex
impl RefUnwindSafe for CodeIndex
impl Send for CodeIndex
impl Sync for CodeIndex
impl Unpin for CodeIndex
impl UnsafeUnpin for CodeIndex
impl UnwindSafe for CodeIndex
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
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>
Converts
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>
Converts
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