Record

Enum Record 

Source
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

Source

pub fn new_root(start_tock: Tock) -> Self

Create a new root record.

Source

pub fn new_head( replayer: Rc<Replayer>, start_tock: Tock, start_time: Time, ) -> Self

Create a new head record.

Source

pub fn new_value(result_tock: Tock, context_start_tock: Tock) -> Self

Create a new value record.

Source

pub fn start_tock(&self) -> Tock

Get start tock.

Source

pub fn values(&self) -> &[Option<Rc<dyn EZombieNode>>]

Get values in this record.

Source

pub fn push_value(&mut self, node: Rc<dyn EZombieNode>)

Push a value to this record.

Source

pub fn register_dependency(&mut self, tock: Tock)

Register a dependency on the current record.

Source

pub fn dependencies(&self) -> &[Tock]

Get dependencies as a slice.

Source

pub fn space_taken(&self) -> Space

Get space taken.

Source

pub fn is_head(&self) -> bool

Check if this is a head record.

Source

pub fn is_value(&self) -> bool

Check if this is a value record.

Source

pub fn is_tailcall(&self) -> bool

Check if this is a tailcall record (HeadRecord).

Source

pub fn get_result_tock(&self) -> Option<Tock>

Get result tock (for ValueRecord).

Source

pub fn get_context_start_tock(&self) -> Option<Tock>

Get the start_tock of the context containing this record’s result (for ValueRecord).

Source

pub fn get_replayer(&self) -> Option<Rc<Replayer>>

Get replayer (for HeadRecord).

Source

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).

Source

pub fn resume(&mut self, new_tock: Tock)

Called when child record returns.

Source

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.

Source

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).

Trait Implementations§

Source§

impl Debug for Record

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Record

§

impl !RefUnwindSafe for Record

§

impl !Send for Record

§

impl !Sync for Record

§

impl Unpin for Record

§

impl !UnwindSafe for Record

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> 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, 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.