Skip to content

Conversation

@blind-oracle
Copy link

@blind-oracle blind-oracle commented Apr 1, 2025

This makes a Clock trait a generic parameter, allowing to use e.g. FakeRelativeClock in tests to avoid waiting.
Public API gets default_with_clock() method that allows creating a builder with a custom Clock.

Clock defaults to DefaultClock as before, so API shouldn't break, but since most of public types got additional generic parameter - some code that references them might break, so it's a breaking change.

I'm not sure if it's possible to avoid that since Clock generic parameter boils down to RateLimiter from governor crate and RateLimiter doesn't expose any specific trait it seems so we can't just Box<dyn ...> it... maybe I am missing something here.

Fixes #50

@benwis
Copy link
Owner

benwis commented Aug 14, 2025

Apologies for the delay in responses. If you could get the conflicts resolved, I'll get this merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to use mocked time

2 participants