Anything like object-pool in futures crate?

Hey, guys!

I have an app runs in with futures crate. I wanna have something like object-pool (or connection-pool) to limit parallel access to some internal resource. This may look like waiting on the pool’s future and when there is one object/connection become available (saying, returned by other future to the poll), the parked future should be notified and executed. There are queue-like utils in futures, maybe I could wait on the Stream of the queue but I don’t know how to just get a single one from it.

But I didn’t find anything like that. Do you know any?

This can be done with semaphore in tokio-sync: https://docs.rs/tokio-sync/0.1.6/tokio_sync/semaphore/index.html

1 Like