Function convergence::server::run_background
source · [−]pub async fn run_background<E: Engine>(
bind: BindOptions,
engine_func: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = E> + Send>> + Send + Sync>
) -> Result<u16>
Expand description
Starts a server using a function responsible for producing engine instances and set of bind options.
Returns once the server is listening for connections, with the accept loop running as a background task, and returns the listener’s local port.
Useful for creating test harnesses binding to port 0 to select a random port.