John-John Tedro

Results 376 comments of John-John Tedro

I like the idea for a bytes encoder which you have to specifically specify size up front, I personally never had a use for it but it seems like you...

You can now [allocate buffers](https://docs.rs/musli/latest/musli/alloc/trait.Allocator.html#tymethod.new_raw_vec) which then can be used in combination with bytes encoding to add whatever dynamically sized payload you want in an encoding.

So something like this? ```rust if !limiter.try_acquire(100) { return Err(..); } ``` How would you like it to behave if there are tasks waiting for tokens? For a [fair scheduler](https://docs.rs/leaky-bucket/latest/leaky_bucket/#fairness)...

There is an implementation in git now if you want to give it a try and report back.

Ah. That's actually how `try_acquire` works, the documentation was a bit fuzzy, so I fixed that.

Ah, yeah. It seems I reproduced an existing issue that I've already fixed in the async version when implementing `try_acquire`. [This part here](https://github.com/udoprog/leaky-bucket/blob/main/src/lib.rs#L750) should actually be doing this: ```rust state.balance...

Very neat! Could you include an example how this is used in the PR description?

I don't think there's any outstanding issues, I'll rebase it once I'm done with the `fmt` refactoring.

I've rebased this and updated the PR to work with the latest upstream. I'm working on including a local example so I can try it out, then I'll merge it.

Can't be disabled, but I'm also not sure if we should. Since [this matches the behavior of Rust](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=46e079a656206b0bd7cc4525d062910a). In the future I do want to support other integer types, and...