pub struct SemanticCacheIndex {
pub entries: Vec<SemanticCacheEntry>,
pub idf: HashMap<String, f64>,
pub total_docs: usize,
pub term_document_freq: HashMap<String, usize>,
/* private fields */
}Fields§
§entries: Vec<SemanticCacheEntry>§idf: HashMap<String, f64>§total_docs: usize§term_document_freq: HashMap<String, usize>Documents containing each term (unique terms per entry).
Implementations§
Source§impl SemanticCacheIndex
impl SemanticCacheIndex
Sourcepub fn add_file(&mut self, path: &str, content: &str, session_id: &str)
pub fn add_file(&mut self, path: &str, content: &str, session_id: &str)
Index content of path. Only text storage admission keeps enters:
a withheld or restricted source leaves no entry (an earlier one of the
same path is dropped), and entries admitted under another policy are
dropped before the first write under this one.
pub fn find_similar( &mut self, content: &str, threshold: f64, ) -> Vec<(String, f64)>
pub fn save(&self, project_root: &str) -> Result<(), String>
pub fn load(project_root: &str) -> Option<Self>
pub fn load_or_create(project_root: &str) -> Self
Trait Implementations§
Source§impl Clone for SemanticCacheIndex
impl Clone for SemanticCacheIndex
Source§impl Debug for SemanticCacheIndex
impl Debug for SemanticCacheIndex
Source§impl Default for SemanticCacheIndex
impl Default for SemanticCacheIndex
Source§impl<'de> Deserialize<'de> for SemanticCacheIndex
impl<'de> Deserialize<'de> for SemanticCacheIndex
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for SemanticCacheIndex
impl Freeze for SemanticCacheIndex
impl Move for SemanticCacheIndex
impl RefUnwindSafe for SemanticCacheIndex
impl Send for SemanticCacheIndex
impl Sync for SemanticCacheIndex
impl Unpin for SemanticCacheIndex
impl UnsafeUnpin for SemanticCacheIndex
impl UnwindSafe for SemanticCacheIndex
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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