Skip to main content

MemoryHit

Struct MemoryHit 

Source
pub struct MemoryHit {
    pub score: u32,
    pub memory: bool,
    pub id: i64,
    pub kind: &'static str,
    pub scope: String,
    pub anchor: Option<String>,
    pub anchor_state: &'static str,
    pub applies: bool,
    pub evidence: f64,
    pub snippet: Option<String>,
}
Expand description

A hit in the memory channel: something a session learned, never a graph fact and never a re-derivable one.

Deliberately not a SearchHit, for the reason GeneratedHit is not: a memory record has no node, no provenance and no key, and giving it a NodeSummary would be the first step towards its being treated like one. Unlike either of the other channels, it also carries what the tree thinks of itMemoryHit::applies and MemoryHit::anchor_state — because a lesson about code that has since moved is worth reading and worth labelling, and returning it unlabelled would be the worse of the two mistakes.

Fields§

§score: u32

Relevance within the memory channel. Not comparable with a SearchHit::score or a GeneratedHit::score: three channels, three scorers, on purpose.

§memory: bool

Always true. A marker a consumer cannot miss or forget to check.

§id: i64

The record’s id — its generation, and what roteiro memory forget takes.

§kind: &'static str

What kind of knowledge it is (lesson | attempt | …).

§scope: String

The namespace it was recorded in. Not a branch label.

§anchor: Option<String>

The node key it is anchored to, if any.

§anchor_state: &'static str

What that anchor is worth against the current tree (valid | drifted | vanished | unverifiable | unanchored).

§applies: bool

Whether this record applies to the tree being searched. A false here is a label, never a reason to have withheld the hit.

§evidence: f64

The evidence multiplier the record’s own ranking gave it (base_confidence × anchor_penalty), reported so the channel’s score can be taken apart.

§snippet: Option<String>

A bounded, whitespace-collapsed excerpt of the body, on the same terms as SearchHit::snippet.

Trait Implementations§

Source§

impl Clone for MemoryHit

Source§

fn clone(&self) -> MemoryHit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryHit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MemoryHit

Source§

fn eq(&self, other: &MemoryHit) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MemoryHit

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MemoryHit

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.