Skip to content

ApplicationState

When generating the server SDK crate, Pavex examines all the components you registered to determine which singletons will be used at runtime to process incoming requests.
Pavex then generates a type to group them together, named ApplicationState.

build_application_state

Inside the server SDK crate, you'll also find a function named build_application_state. As the name suggest, it returns an instance of ApplicationState.

build_application_state takes as input all the types that you marked as prebuilt. Inside its body, it'll invoke the constructors for all your singletons in order to build an instance of ApplicationState.