Function perseus::engine::run_dflt_engine
source · pub async fn run_dflt_engine<M, T, F, A>(
op: EngineOperation,
app: A,
serve_fn: impl Fn(&'static Turbine<M, T>, ServerOptions, (String, u16)) -> F
) -> i32where
M: MutableStore + 'static,
T: TranslationsManager + 'static,
F: Future<Output = ()>,
A: Fn() -> PerseusAppBase<SsrNode, M, T> + 'static + Send + Sync + Clone,
Expand description
A convenience function that automatically runs the necessary engine operation based on the given directive. This provides almost no options for customization, and is usually elided by a macro. More advanced use-cases should bypass this and call the functions this calls manually, with their own configurations.
The third argument to this is a function to produce a server. In simple
cases, this will be the dflt_server
export from your server integration of
choice (which is assumed to use a Tokio 1.x runtime). This function must be
infallible (any errors should be panics, as they will be treated as
unrecoverable).
If the action is to export a single error page, the HTTP status code of the
error page to export and the output will be read as the first and second
arguments to the binary invocation. If this is not the desired behavior, you
should handle the EngineOperation::ExportErrorPage
case manually.
This returns an exit code, which should be returned from the process. Any handled errors will be printed to the console.