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§
- Focus
View - The focused widget’s ephemeral presentation state, captured through the
same mechanism the undo path uses to restore a caret across a rebuild.
ordinalis stable exactly when the tree shape is — the condition under which restoring a caret is meaningful;ephemeralis the opaque string from [crate::widget::Widget::get_state]/set_state. - Frozen
App - 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/Deserializeso a future presence layer can broadcast any subset.View::defaultis “top of the document, nothing focused, no resource” — the correct starting point for a freshly-launched app. - View
Contribution - 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 intoFocusView::ephemeralbecause 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. - View
Rect - A rectangle in physical pixels — the app’s viewport at capture time.
- View
Subset - The broadcastable subset of a
View— the region and resource a participant is looking at, minus the caret/selection.
Enums§
- Thaw
Error - Why a
FreezeThaw::thawfailed. 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
FrozenAppchanges in a way older readers cannot decode;FreezeThaw::thawrefuses a version it does not understand rather than mis-reading it.
Traits§
- Freeze
Thaw - Freeze/thaw for a Tilo app, extendable at exactly one seam.