pub struct CapabilityMemory { /* private fields */ }Expand description
In-memory store. Keyed by problem_signature. Phase 5 will add persistence; Phase 2 keeps it in RAM.
Implementations§
Source§impl CapabilityMemory
impl CapabilityMemory
pub fn new() -> Self
Sourcepub fn lookup(&self, signature: &str) -> Option<&MemoryEntry>
pub fn lookup(&self, signature: &str) -> Option<&MemoryEntry>
Look up a prior run by problem signature.
Sourcepub fn upsert(&mut self, record: CapabilityMemoryRecord, metrics: &ToolMetrics)
pub fn upsert(&mut self, record: CapabilityMemoryRecord, metrics: &ToolMetrics)
Insert or update an entry, accumulating metrics.
Sourcepub fn save(&self, path: &Path) -> Result<(), String>
pub fn save(&self, path: &Path) -> Result<(), String>
Serialize all entries to a JSON file at path.
Sourcepub fn load(path: &Path) -> Result<Self, String>
pub fn load(path: &Path) -> Result<Self, String>
Load entries from a JSON file. Returns an empty store if the path does
not exist (first run). Returns Err only on parse failures.
pub fn is_empty(&self) -> bool
Sourcepub fn derive_signature(req: &CapabilityRequest) -> String
pub fn derive_signature(req: &CapabilityRequest) -> String
Derive a stable problem signature from a capability request. The signature is capability + input shape + output shape, lowercased and hyphen-joined. It is not a hash — it is human-readable and stable.
Trait Implementations§
Source§impl Debug for CapabilityMemory
impl Debug for CapabilityMemory
Source§impl Default for CapabilityMemory
impl Default for CapabilityMemory
Source§fn default() -> CapabilityMemory
fn default() -> CapabilityMemory
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CapabilityMemory
impl RefUnwindSafe for CapabilityMemory
impl Send for CapabilityMemory
impl Sync for CapabilityMemory
impl Unpin for CapabilityMemory
impl UnsafeUnpin for CapabilityMemory
impl UnwindSafe for CapabilityMemory
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