pub struct TrigramIndex { /* private fields */ }Implementations§
Source§impl TrigramIndex
impl TrigramIndex
pub fn file_path(&self, id: FileId) -> Option<&Path>
pub fn file_abs_path(&self, id: FileId) -> Option<PathBuf>
Sourcepub fn explain(&self, query: &QuerySpec<'_>) -> QueryPlanOutput
pub fn explain(&self, query: &QuerySpec<'_>) -> QueryPlanOutput
Returns an explanation of how a query would be handled.
pub fn root(&self) -> &Path
pub const fn corpus_kind(&self) -> CorpusKind
pub fn candidates(&self, query: &QuerySpec<'_>) -> Vec<Candidate>
pub fn all_files(&self) -> Vec<Candidate>
Sourcepub fn build(config: &IndexConfig<'_>, output_dir: &Path) -> Result<Self>
pub fn build(config: &IndexConfig<'_>, output_dir: &Path) -> Result<Self>
Build a new trigram index from the corpus described in config.
§Errors
Returns an error if corpus walking, extraction, or file I/O fails.
Sourcepub fn open(
index_dir: &Path,
root: &Path,
corpus_kind: CorpusKind,
) -> Result<Self>
pub fn open( index_dir: &Path, root: &Path, corpus_kind: CorpusKind, ) -> Result<Self>
Open a previously persisted trigram index from index_dir.
§Errors
Returns an error if persistence files are missing or malformed.
Sourcepub fn update(
&self,
config: &IndexConfig<'_>,
output_dir: &Path,
) -> Result<Option<Self>>
pub fn update( &self, config: &IndexConfig<'_>, output_dir: &Path, ) -> Result<Option<Self>>
Update the index from the current corpus, reusing per-file trigram sets for unchanged files.
Returns Ok(Some(index)) if a new snapshot was written, or Ok(None)
if no files changed.
§Errors
Returns an error if corpus walking, extraction, or file I/O fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrigramIndex
impl RefUnwindSafe for TrigramIndex
impl Send for TrigramIndex
impl Sync for TrigramIndex
impl Unpin for TrigramIndex
impl UnsafeUnpin for TrigramIndex
impl UnwindSafe for TrigramIndex
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> 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