Skip to main content

set_runtime

Function set_runtime 

Source
pub fn set_runtime(runtime: Runtime) -> Result<(), Runtime>
Expand description

Sets a custom pre-built Tokio runtime as the global Nautilus runtime.

Must be called before the first get_runtime invocation (i.e. before LiveNode::build() or any adapter/client usage). This gives callers who own main() full control over worker threads, blocking threads, thread names, stack sizes, and any other tokio::runtime::Builder options.

§Runtime Requirements

The supplied runtime must be multi-threaded and have all Tokio drivers enabled with tokio::runtime::Builder::enable_all().

§Errors

Returns Err(runtime) if a runtime was already initialized.