pub struct MemoryChunk {
pub file: String,
pub line_start: i32,
pub line_end: i32,
pub content: String,
pub score: f64,
pub updated_at: i64,
}Expand description
A chunk of memory content returned from search
Fields§
§file: StringFile path relative to workspace
line_start: i32Starting line number (1-indexed)
line_end: i32Ending line number (1-indexed)
content: StringThe actual content
score: f64Relevance score (higher is better)
updated_at: i64Unix timestamp when the chunk was last updated (for temporal decay)
Implementations§
Source§impl MemoryChunk
impl MemoryChunk
Sourcepub fn new(
file: String,
line_start: i32,
line_end: i32,
content: String,
score: f64,
) -> Self
pub fn new( file: String, line_start: i32, line_end: i32, content: String, score: f64, ) -> Self
Create a new memory chunk
Sourcepub fn with_timestamp(self, updated_at: i64) -> Self
pub fn with_timestamp(self, updated_at: i64) -> Self
Create a new memory chunk with timestamp
Sourcepub fn apply_temporal_decay(&mut self, lambda: f64, now_unix: i64) -> f64
pub fn apply_temporal_decay(&mut self, lambda: f64, now_unix: i64) -> f64
Apply temporal decay to the score based on age. decay_factor = exp(-lambda * age_days) Returns the decayed score.
Trait Implementations§
Source§impl Clone for MemoryChunk
impl Clone for MemoryChunk
Source§fn clone(&self) -> MemoryChunk
fn clone(&self) -> MemoryChunk
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryChunk
impl Debug for MemoryChunk
Source§impl<'de> Deserialize<'de> for MemoryChunk
impl<'de> Deserialize<'de> for MemoryChunk
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 Freeze for MemoryChunk
impl RefUnwindSafe for MemoryChunk
impl Send for MemoryChunk
impl Sync for MemoryChunk
impl Unpin for MemoryChunk
impl UnsafeUnpin for MemoryChunk
impl UnwindSafe for MemoryChunk
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> 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>
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