Skip to main content

publish_collected

Function publish_collected 

Source
pub fn publish_collected(world: &World) -> usize
Expand description

Run every subscription the world carries, publishing what each collects.

Returns how many subscriptions are still alive, so a world can skip the work its collectors would have done when there are none. A reader that has been dropped is pruned here: the world stops collecting for it on the next tick.

A runner that drives a world — its thread, the host stepping it, or the host draining a sub-world — calls this itself at the end of every turn, after the state a collector reads has been updated, so a tick body publishes nothing by hand. That is the runner’s contract rather than a guard: a host that drives a world of its own calls this once per turn, and calling it twice would run every collector twice.