udoprog / leaky-bucket

A token-based rate limiter based on the leaky bucket algorithm.
Apache License 2.0
93 stars 10 forks source link

Use a bit less unsafe #21

Closed udoprog closed 6 months ago

udoprog commented 6 months ago

This adopts part of, and supersedes #18, I've opted to not introduce pin-project-lite since I don't want to introduce it as a dependency. I've also adopted a slightly different strategy for avoiding unsafe by accessing internal state through a closure.