actix-net
actix-net copied to clipboard
Make System::with_tokio_rt take a `FnOnce`
System::with_tokio_rt
currently takes a Fn
, which is quite restricting, since it does not allow moving ownership of captured variables into the closure (at least not in a clean way). This is especially useful if the runtime had to be initialized before the system and was stored in a global variable or passed as an argument.
The code in with_tokio_rt
only calls the closure once, and since Fn: FnMut
and FnMut: FnOnce
, this should not be a breaking change.