pub struct Bundle {
pub component: Arc<str>,
pub wire_id: String,
pub view: Core,
pub validate: Core,
pub fold: Core,
pub init: Core,
pub defs: BTreeMap<Arc<str>, Core>,
pub command: Schema,
pub optimistic: bool,
pub reads_freshness: bool,
pub gestures: Option<Gestures>,
}Expand description
A component’s slice: the code, and nothing else.
Fields§
§component: Arc<str>The signal this bundle renders — the component’s name in the program, and what
beck explain render prints.
wire_id: StringThe program’s content-derived command-channel id (§4.3). A client that reconnects to a server running a different program finds out here rather than by sending it a command it cannot decode.
view: Core(state, session, presence, awareness, freshness, interface) -> Html.
validate: Core(state, proposal) -> Result[list[Event], Rejection].
fold: Core(state, Envelope[Event]) -> state.
init: CoreThe fold’s initial accumulator, as an expression rather than a value: evaluating it is the
kernel’s first act, and a Value would have needed a second encoding for the same thing.
defs: BTreeMap<Arc<str>, Core>Every definition the four roles reach, transitively.
command: SchemaWhat the client may send, resolved: enough to turn a data-b-click attribute into the
Command value validate expects, and to refuse anything else.
optimistic: boolWhether this component’s client may run Bundle::validate and Bundle::fold on what it
holds — see crate::render for what decides it, and why holding the state is the whole
question.
reads_freshness: boolWhether this component’s view reads freshness() — §3.7’s freshness dimension.
The client needs it for one reason and it is not rendering: a page that does not observe
freshness must keep docs/94 §94.12’s
shortcut, where a confirmation that does not move the state costs no render. Comparing the
freshness unconditionally would make every confirmation move it — from Pending(1) to
Confirmed — and hand every program in the tree back the second render that report
removed.
gestures: Option<Gestures>gestures(step, init), when the page keeps client-local interface state — D30’s
non-durable fold.
It travels in the bundle because this is the only side that can run it: a gesture never
reaches the server, so a client that could not fold its own would have interface state
nobody could advance. None for a page that keeps none, which is every page compiled
before D30.