brandur/redis-cell

Publish on crates.io?

dpc opened this issue · 4 comments

dpc commented

Hi,

I would like to use this library in my project. Basically I want a coupled/embedded rate limiter via in memory Store.

But I can't find it on crates.io. Is there any reason for that?

dpc commented

BTW. Is there any reason why RateLimiter doesn't just own Store? It's not convenient if it requires a mutable reference, forcing to use crates like rental and what not.

But I can't find it on crates.io. Is there any reason for that?

Not really — I just figured that it was not all that useful as a crate.

I've just published it now though. We may as well have it up there.

BTW. Is there any reason why RateLimiter doesn't just own Store? It's not convenient if it requires a mutable reference, forcing to use crates like rental and what not.

If I understand the question correctly, it's so we can perform dependency injection. In tests, we can create a RateLimiter and inject a TestStore so that we don't need a real Redis dependency.

dpc commented

You can inject T: Store, and not have to deal with lifetimes and such: dpc/ratelimit-gcra@378d5e1

@dpc Thanks for the tip! There was no reason for the previous way beyond that I didn't know this trick in Rust. I implemented something very similar to your change in #28.