Skip to content

Make System::with_tokio_rt take a FnOnce #452

@DzenanJupic

Description

@DzenanJupic

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions