Skip to main content

Module util

Module util 

Source
Expand description

Utility functions for simple use cases.

In all cases, the number of threads is specified as a parameter, and the function takes care of creating the Hive (with channel-based task queues), submitting tasks, collecting results, and shutting down the Hive properly.

Functionsยง

map
Convenience function that creates a Hive with num_threads worker threads that execute the provided callable on the provided inputs and returns a Vec of the results.
try_map
Convenience function that creates a Hive with num_threads worker threads that execute the provided callable on the provided inputs and returns a Vec of the results, or an error if any of the tasks failed.