Module runtimes

Source
Expand description

Runtimes are the starting point of a reactive-signals based application. Internally, the runtimes presents a simple boolean constant to let the Scopes and Signals know where they are running. Like that a signal marked with server or client knows if it should run.

There are two types of runtimes:

  • Pooled runtimes: Allows for many runtimes in a thread.
  • Single runtimes: Limitied to one runtime per thread.

A runtime presents a single function: new_root_scope() which returns a root Scope. When the root scope is discarded, using it’s discard() function, the runtime is discarded as well.

Single runtimes have no memory overhead, whereas pooled runtimes have an overhead of 2 bytes which is the index in the pool. As a consequence a pool can have at most 65k runtimes.

Structs§

ClientRuntime
A runtime meant to be used client-side because there can only be one per thread.
ServerRuntime
A runtime meant to be used client-side because there can only be one per thread.
TestClientRuntime
A runtime meant to be used for testing only. It uses a pool of runtimes, so that many runtimes can co-exist on one thread, but simulates running on a client.