Skip to main content

TemporalIndex

Struct TemporalIndex 

Source
pub struct TemporalIndex { /* private fields */ }

Implementations§

Source§

impl TemporalIndex

Source

pub fn new() -> Self

Source

pub fn load(&mut self, record: TemporalRecord)

Seeds one persisted row (temporalIndex()’s KV load loop in src/core/compositor.ts calls this once per row, in KV scan order — ascending id).

Source

pub fn decide( &mut self, comp_bounds: Rect, comp_blocks: &[(i32, i32)], frame: u32, time: f64, visible: Rect, latest_policy: bool, next_seq: u64, ) -> (usize, u64)

The decision half of resolveTemporal up to (not including) the maskComplete walk — everything that does not need atlas/occlusion/consistency pixels. Stashes the candidate record and returns how many blocks mask_complete + the second call will need a buffer for (0 means this component’s record cannot be chosen this frame, regardless of what the mask check would say), plus the (possibly incremented) fresh-id sequence counter.

next_seq is NOT this index’s own state: Compositor.temporalSequence in src/core/compositor.ts is a single counter shared across every canvas the Compositor ever touches (not reset per canvas), so the caller threads it through every decide() call on every canvas’s handle and keeps the returned value — never derived from loaded ids, which is why a fresh id can collide with a still-loaded row (see the id-collision tripwire tests in tests/unit/compositor.test.ts).

Source

pub fn pending_write_blocks(&self) -> &[(i32, i32)]

The write-block set decide computed for the currently pending component (empty if none is pending, or if it decided not to choose this component this frame) — read by the caller to run mask_complete before calling commit.

Source

pub fn commit(&mut self, mask_complete_ok: bool) -> Option<CommitOut>

Finalises the component decide staged: mirrors resolveTemporal’s tail (record commit into records/dirty/deleted, and the INCOMPLETE_TEMPORAL_PATCH condition). mask_complete_ok is the result of running mask_complete over pending_write_blocks() — irrelevant when decide already chose not to attempt this component (chosen is then false regardless of this argument).

Source

pub fn flush_sizes(&self) -> (usize, usize, usize)

Sizes for the buffers flush_take will need: how many ids deleted (persisted rows to delete) and dirty (persisted rows to (re)write) hold, and the total block count across every dirty record’s current key set (persistedBlocks output length, summed) — flush() writes exactly these rows, deletions first, in this order, mirrors Compositor.flush().

Source

pub fn flush_take(&mut self) -> (Vec<String>, Vec<DirtyRow>)

Drains deleted (in order) and dirty (in order, with each record’s current content and persisted-order block list), clearing both. The counts must match a flush_sizes() call made with no decide/commit/load in between (the caller sizes its output buffers from that call).

Trait Implementations§

Source§

impl Default for TemporalIndex

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.