pub struct Association {
pub source: Uuid,
pub target: Uuid,
pub association_type: String,
pub weight: f32,
pub created_at: DateTime<Utc>,
pub link_type: LinkType,
pub co_activation_count: u32,
pub last_activated_at: DateTime<Utc>,
pub decay_half_life_days: f32,
}Expand description
An association between two memories.
Fields§
§source: UuidSource memory UUID
target: UuidTarget memory UUID
association_type: StringLegacy association type string (auto-populated from link_type)
weight: f32Weight / strength (0.0 to 1.0) — dynamic, Hebbian
created_at: DateTime<Utc>Creation timestamp
link_type: LinkTypeTyped link kind
co_activation_count: u32Number of co-activations (Hebbian counter)
last_activated_at: DateTime<Utc>Last time this link was activated (for decay computation)
decay_half_life_days: f32Decay half-life in days for the link weight
Implementations§
Source§impl Association
impl Association
Sourcepub fn new(source: Uuid, target: Uuid, link_type: LinkType, weight: f32) -> Self
pub fn new(source: Uuid, target: Uuid, link_type: LinkType, weight: f32) -> Self
Create a new typed association.
Sourcepub const fn with_half_life_days(self, days: f32) -> Self
pub const fn with_half_life_days(self, days: f32) -> Self
Create a new association with a custom decay half-life.
Sourcepub fn activate(&mut self)
pub fn activate(&mut self)
Hebbian co-activation — strengthens the link weight.
Boosts weight by 0.1 * (1.0 - current_weight) (diminishing returns),
increments co_activation_count, and updates last_activated_at.
Sourcepub fn decay(&mut self, now: DateTime<Utc>)
pub fn decay(&mut self, now: DateTime<Utc>)
Apply exponential decay to link weight based on time since last activation.
weight *= 0.5 ^ (days_since_activation / decay_half_life_days)
Sourcepub fn should_prune(&self, threshold: f32) -> bool
pub fn should_prune(&self, threshold: f32) -> bool
Whether this link has decayed below a pruning threshold.
Sourcepub fn encode_key(&self) -> Vec<u8> ⓘ
pub fn encode_key(&self) -> Vec<u8> ⓘ
Encode the composite key: source(16) + target(16) = 32 bytes.
Trait Implementations§
Source§impl Clone for Association
impl Clone for Association
Source§impl Debug for Association
impl Debug for Association
Source§impl<'de> Deserialize<'de> for Association
impl<'de> Deserialize<'de> for Association
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 Association
impl RefUnwindSafe for Association
impl Send for Association
impl Sync for Association
impl Unpin for Association
impl UnsafeUnpin for Association
impl UnwindSafe for Association
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
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>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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 more