I'm new to rust (2 days in) and have recently been playing with the async functionality, I've been reading as much documentation as I can find. I set myself the task of creating a async stream backed by a thread-safe stack (LIFO) to recycle values.
While this solution works, it seems complicated for what i'm trying to achieve, I feel like I'm missing something simpler. if anyone has any feedback and links to documentation or other examples that I can use to improve this pattern. It would be greatly appreciated.
I typically recommend people use Tokio anyway. In principle it's okay to use Tokio's Semaphore outside of Tokio, but there are many of Tokio's types for which this is not fine, so it can be risky.
As for the Treiber stack, well I don't think a structure like the one you built exists in any of the crates I know of. That's probably related to the fact that it's pretty rare for people to need an async Treiber stack. I'm guessing that Tokio would accept a PR with such a collection.