Skip to main content

Module view

Module view 

Expand description

The View: an app’s presentation layer, distinct from its state.

A Tilo app owns two pieces of live state: the State document (an Automerge CRDT in crate::state::State) is the collaborative truth, merged and serialized with doc.save(); the View is everything about where the user is looking that is deliberately not merged — scroll, caret/selection, open resource, viewport, view mode.

Two uses: presence (not here) broadcasts a subset so others can see and follow a participant; freeze/thaw (here) serializes State and View into one versioned envelope and restores both — backing OS memory-eviction, reboot, and crash recovery, so a thawed app is the same place, not merely the same data. It routes through a single override hook, FreezeThaw::serialize_state / FreezeThaw::restore_state, defaulting to the CRDT save/load; a non-CRDT app overrides just those two.

Modules§

capability
Presentation state (scroll offset, view mode) a root contributes to the App’s View.

Structs§

FocusView
The focused widget’s ephemeral presentation state, captured through the same mechanism the undo path uses to restore a caret across a rebuild. ordinal is stable exactly when the tree shape is — the condition under which restoring a caret is meaningful; ephemeral is the opaque string from [crate::widget::Widget::get_state]/set_state.
FrozenApp
The versioned freeze envelope: an app’s serialized state bytes alongside its captured View. Collaboration and freeze/thaw serialize the same state; this pairs it with the presentation so a restore lands the user back where they were, not merely on the same data.
View
A participant’s View: everything about where they are looking that is never merged into anyone else’s. Every field derives Serialize/Deserialize so a future presence layer can broadcast any subset. View::default is “top of the document, nothing focused, no resource” — the correct starting point for a freshly-launched app.
ViewContribution
The typed presentation fields a widget contributes to (and has restored from) the View — its scroll offset(s) and its current view mode. Kept structured rather than folded into FocusView::ephemeral because a presence layer wants to broadcast scroll/view-mode on their own — “this peer is scrolled here, in grid mode” — independent of whether the scrolling container is the focused widget.
ViewRect
A rectangle in physical pixels — the app’s viewport at capture time.
ViewSubset
The broadcastable subset of a View — the region and resource a participant is looking at, minus the caret/selection.

Enums§

ThawError
Why a FreezeThaw::thaw failed. Thaw never panics — truncated or garbage bytes, an unknown version, or an unloadable state payload all surface here.

Constants§

FROZEN_VERSION
Envelope format version. Bump when the wire shape of FrozenApp changes in a way older readers cannot decode; FreezeThaw::thaw refuses a version it does not understand rather than mis-reading it.

Traits§

FreezeThaw
Freeze/thaw for a Tilo app, extendable at exactly one seam.