-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The RingBuffer
trait
#3
Comments
I think we should start small, so maybe without peek. For reference: Re: I like how we're already running into keyword generics territory. |
A ring buffer is a kind of iterator, where |
No? Peek on iterators has a very well-defined meaning that's not "get some random element from the collection". If it matched the signature of iterator peek I'd agree with you, but it's not |
Here's a sketch of what the
RingBuffer
trait should look like:I'm still not sure about the peek methods, but they're here to facilitate discussion on better APIs. Are there any other functions or types we want to include here (e.g. for iterators)?
I think a fairly common use case is ring buffers that are always full - let's call them
SaturatedRingBuffer
s. They can have their own trait, and it might look like this:Note that there are a few shared/similar items here. Can we unify them between the two traits, and how might we do that?
The text was updated successfully, but these errors were encountered: