Files
craft-libs/crates/ui-contract/tests
aiongg dd0666065e ui-contract: pass-local service state
The services the pipeline touches on every run live in one PassState with a
RefCell field each. The begin hook of a context's outermost pass on a thread
moves it out of context data into the thread; the end hook moves it back.
Inside a pass a service access is a borrow of a plain field: no TypeId map
probe, no Arc handle, no mutex. Access outside a pass holds the state for
that one call.

PerViewport types say where their records live through the Stored trait:
a context service by default, a PassState field for the pass-local ones.

The thread-local handle map (HANDLES, ContextToken, open_handles) goes;
Service::run is a context-data lookup for the services that stay there.
A testing counter of those lookups backs a trial: a settled pass of forty
leaves makes as many lookups as one of ten.
2026-11-12 14:32:39 +00:00
..
2026-11-12 14:32:39 +00:00