pub struct Affinity {Show 16 fields
pub id: Uuid,
pub session_id: Uuid,
pub user_id: Uuid,
pub instance_id: Uuid,
pub warmth: f64,
pub trust: f64,
pub intrigue: f64,
pub intimacy: f64,
pub patience: f64,
pub tension: f64,
pub ghost_streak: i32,
pub last_ghost_at: Option<DateTime<Utc>>,
pub total_ghosts: i32,
pub relationship_label: Option<RelationshipLabel>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Fields§
§id: Uuid§session_id: Uuid§user_id: Uuid§instance_id: Uuid§warmth: f64§trust: f64§intrigue: f64§intimacy: f64§patience: f64§tension: f64§ghost_streak: i32§last_ghost_at: Option<DateTime<Utc>>§total_ghosts: i32§relationship_label: Option<RelationshipLabel>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Affinity
impl Affinity
Sourcepub fn apply_deltas(&mut self, d: &AffinityDeltas, ema_inertia: f64)
pub fn apply_deltas(&mut self, d: &AffinityDeltas, ema_inertia: f64)
Apply LLM-evaluated deltas with EMA smoothing.
ema_inertia ∈ [0, 1] — 0 means full update; v1 default is 0.5 (gain 0.5).
pub fn apply_time_decay(&mut self)
Sourcepub fn legacy_relationship_label(&self) -> RelationshipLabel
pub fn legacy_relationship_label(&self) -> RelationshipLabel
Legacy 5-name relationship label (back-compat), derived purely from the
two line scores — replaces the old multi-axis infer_label heuristic.
New consumers should read bond_label/chemistry_label. frenemy is
retired from emission (kept in the enum for parse compat).
Source§impl Affinity
impl Affinity
Sourcepub fn bond_score(&self) -> f64
pub fn bond_score(&self) -> f64
0..1 friendship composite. warmth floored at 0; mirrors the bond
generated column in migration 0029.
Sourcepub fn chemistry_score(&self) -> f64
pub fn chemistry_score(&self) -> f64
0..1 romance composite. warmth floored at 0; mirrors the chemistry
generated column in migration 0029.
Sourcepub fn bond_label(&self) -> BondLabel
pub fn bond_label(&self) -> BondLabel
Friendship-line tier label.
Sourcepub fn chemistry_label(&self) -> ChemistryLabel
pub fn chemistry_label(&self) -> ChemistryLabel
Romance-line tier label.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Affinity
impl<'de> Deserialize<'de> for Affinity
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
impl StructuralPartialEq for Affinity
Auto Trait Implementations§
impl Freeze for Affinity
impl RefUnwindSafe for Affinity
impl Send for Affinity
impl Sync for Affinity
impl Unpin for Affinity
impl UnsafeUnpin for Affinity
impl UnwindSafe for Affinity
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