pub enum Record {
Root(RootRecord),
Head(HeadRecord),
Value(ValueRecord),
}Expand description
Record enum - stack entries for tracking computation state.
This enum replaces the previous RecordNode trait, providing:
- No dynamic dispatch overhead
- Exhaustive pattern matching
- Better memory layout (single allocation)
Variants§
Root(RootRecord)
Root record - top level, not evictable.
Head(HeadRecord)
Head record - active bind computation.
Value(ValueRecord)
Value record - completed computation.
Implementations§
Source§impl Record
impl Record
Sourcepub fn new_head(
replayer: Rc<Replayer>,
start_tock: Tock,
start_time: Time,
) -> Self
pub fn new_head( replayer: Rc<Replayer>, start_tock: Tock, start_time: Time, ) -> Self
Create a new head record.
Sourcepub fn new_value(result_tock: Tock, context_start_tock: Tock) -> Self
pub fn new_value(result_tock: Tock, context_start_tock: Tock) -> Self
Create a new value record.
Sourcepub fn start_tock(&self) -> Tock
pub fn start_tock(&self) -> Tock
Get start tock.
Sourcepub fn values(&self) -> &[Option<Rc<dyn EZombieNode>>]
pub fn values(&self) -> &[Option<Rc<dyn EZombieNode>>]
Get values in this record.
Sourcepub fn push_value(&mut self, node: Rc<dyn EZombieNode>)
pub fn push_value(&mut self, node: Rc<dyn EZombieNode>)
Push a value to this record.
Sourcepub fn register_dependency(&mut self, tock: Tock)
pub fn register_dependency(&mut self, tock: Tock)
Register a dependency on the current record.
Sourcepub fn dependencies(&self) -> &[Tock]
pub fn dependencies(&self) -> &[Tock]
Get dependencies as a slice.
Sourcepub fn space_taken(&self) -> Space
pub fn space_taken(&self) -> Space
Get space taken.
Sourcepub fn is_tailcall(&self) -> bool
pub fn is_tailcall(&self) -> bool
Check if this is a tailcall record (HeadRecord).
Sourcepub fn get_result_tock(&self) -> Option<Tock>
pub fn get_result_tock(&self) -> Option<Tock>
Get result tock (for ValueRecord).
Sourcepub fn get_context_start_tock(&self) -> Option<Tock>
pub fn get_context_start_tock(&self) -> Option<Tock>
Get the start_tock of the context containing this record’s result (for ValueRecord).
Sourcepub fn get_replayer(&self) -> Option<Rc<Replayer>>
pub fn get_replayer(&self) -> Option<Rc<Replayer>>
Get replayer (for HeadRecord).
Sourcepub fn suspend(
&mut self,
replayer: Rc<Replayer>,
current_tock: Tock,
akasha_insert: &mut dyn FnMut(Tock, Rc<dyn ContextNode>),
heap_push: Option<&mut dyn FnMut(Rc<FullContext>)>,
) -> Option<(TockVec, UF)>
pub fn suspend( &mut self, replayer: Rc<Replayer>, current_tock: Tock, akasha_insert: &mut dyn FnMut(Tock, Rc<dyn ContextNode>), heap_push: Option<&mut dyn FnMut(Rc<FullContext>)>, ) -> Option<(TockVec, UF)>
Handle suspension (creates context).
For Root: creates RootContext For Head: creates FullContext (tailcall semantics)
§Returns
For HeadRecord: returns (dependencies, forward_uf) for backedge registration. For RootRecord: returns None (RootContext doesn’t need backedges).
Sourcepub fn complete(
&mut self,
current_tock: Tock,
replayer: Option<Rc<Replayer>>,
akasha_insert: &mut dyn FnMut(Tock, Rc<dyn ContextNode>),
heap_push: &mut dyn FnMut(Rc<FullContext>),
) -> Option<(TockVec, UF)>
pub fn complete( &mut self, current_tock: Tock, replayer: Option<Rc<Replayer>>, akasha_insert: &mut dyn FnMut(Tock, Rc<dyn ContextNode>), heap_push: &mut dyn FnMut(Rc<FullContext>), ) -> Option<(TockVec, UF)>
Handle completion (creates FullContext).
§Returns
Returns (dependencies, forward_uf) for backedge registration, or None if not a HeadRecord.
Sourcepub fn prepare_replay(
&mut self,
get_input: &mut dyn FnMut(Tock) -> Option<Rc<dyn EZombieNode>>,
) -> (Rc<Replayer>, ReplayInputs)
pub fn prepare_replay( &mut self, get_input: &mut dyn FnMut(Tock) -> Option<Rc<dyn EZombieNode>>, ) -> (Rc<Replayer>, ReplayInputs)
Prepare replay by collecting inputs. Returns the replayer and inputs (some may be missing).