tikv / yatp

Yet another thread pool in rust for both callbacks or futures.
Apache License 2.0
135 stars 32 forks source link

*: make spawn easier #25

Closed BusyJay closed 4 years ago

BusyJay commented 4 years ago

This PR adds a new trait WithExtras to make spawn easier. Now spawning futures with default extras in future pool can be as simple as

pool.spawn(f);

rather than in the past

pool.spawn(TaskCell::new(f, queue::extras()));

.

The old way is not removed as user may want to provide a custom extras.

This PR also make the queue types private. Those types can only be used when constructing pool, it's meaningless and distracting to expose the full type.